[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-httpd-users
Subject:    [users@httpd] CGI Error with Readonly Database
From:       Tom Browder <tom.browder () gmail ! com>
Date:       2015-08-25 10:30:42
Message-ID: CAFMGiz_weRC9edkFGyZACW5pPGpjT0_2T0uETR4DsztSdZsbKg () mail ! gmail ! com
[Download RAW message or body]

I am using Apache 2.4.16 and trying to get my CGI programs to work
after transferring to a new remote host.

After much debugging I am finally getting to the point where my script
is trying to insert a new or updated record in my SQLite db and I get
this error:

=======>
Error

Sorry, the following error has occurred:

DBD::SQLite::db do failed: attempt to write a readonly database at
WEB_sqlite3_funcs.pm line 312.
<=======

The permissions in all my Apache server dirs and files are set by a
Perl script like this:

  # set perms on data
  # completely private
  # $TODIR is the appropriate document too dir for each host and aliased dir
  my $cmd1 = "chown -R web-user:web-content $TODIR";
  qx($cmd1);
  my $cmd2 = "find $TODIR -type f -exec chmod 640 {} \\;";
  qx($cmd2);
  my $cmd3 = "find $TODIR -type d -exec chmod 750 {} \\;";
  qx($cmd3);
  my $cmd4 = "find $TODIR -name '*.cgi' -exec chmod 750 {} \\;";
  qx($cmd4);
  my $cmd5 = "find $TODIR -name '*.pl' -exec chmod 750 {} \\;";
  qx($cmd5);

In addition, the html file for one index.html is set 'chmod +X' for
SSI use (for the XbitHack).

I have two special dirs shared by all my virtual hosts set this way in
my httpd.con file:

  # need common cgi directory for all web sites
  ScriptAlias   /cgi-bin-cmn/      /home/web-server-common/cgi-bin-cmn/
  # need common data directory for all web sites
  Alias         /data-cmn/         /home/web-server-common/data-cmn/

Those directories happen to contain the script and db which result in the error.

Running 'ls -l' on the last two directories yields:

root@dedi2:/home# ls -lR web-server-common
web-server-common:
total 8
drwxr-s--- 2 web-user web-content 4096 Aug 25 00:00 cgi-bin-cmn
drwxr-s--- 2 web-user web-content 4096 Aug 21 20:36 data-cmn

web-server-common/cgi-bin-cmn:
total 56
-rw-r----- 1 web-user web-content   648 Aug 23 22:12 CGIBookError.pm
-rw-r----- 1 web-user web-content 14226 Aug 22 22:01 WEB_general_funcs.pm
-rw-r----- 1 web-user web-content 16295 Aug 25 00:00 WEB_sqlite3_funcs.pm
-rwxr-x--- 1 web-user web-content   409 Aug 24 12:23 manip-db.pl
-rwxr-x--- 1 web-user web-content   250 Aug 21 13:28 show-envvars.cgi
-rwxr-x--- 1 web-user web-content  8087 Aug 24 01:28 show-site-statistics.cgi
-rwxr-x--- 1 web-user web-content  3539 Aug 24 22:39 update-site-statistics.cgi

web-server-common/data-cmn:
total 2012
-rw-r----- 1 web-user web-content 2059264 Aug 21 15:51
domain-access-stats.sqlite


Any ideas, or do you need more info from me?

Thanks.

Best regards,

-Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic