Ano-Tech Computers
Enter keyword:

Apache no longer has access to script files etc.
Problem:
After upgrading Apache, certain CGI scripts no longer seem to work while others work just fine. The log file "/var/log/httpd/error_log" contains messages like this: "file permissions deny server execution: /path/to/myscript.cgi" Other scripts will execute but can't access its data files. Some of them just fail in various weird ways, others complain about lack of file permissions.
 
Solution:
Recent rpm versions of Apache run as apache/apache instead of nobody/nobody. The UID and GID are different, which effectively means Apache no longer has ownership of the relevant scripts and/or data files.

There are two ways to solve this problem:

* The quick and dirty one: change the UID of the "apache" user from the default 48 to 99 to match the "nobody" user.

* The proper one: change ownership of all files currently belonging to "nobody" to "apache". This MAY break other user-made services on the server so be careful.

Also, make sure to set the home directory in /etc/passwd to a directory where the apache/nobody user has write permissions, like /tmp (not recommended unless ALL users are trusted) or a directory created for that purpose (much safer)
 
Discuss this solution
Did this article solve your problem? Yes No Did not apply

We welcome anyone who is willing to contribute to this public knowledge base, contact siteadmin@atc.no if you have information you would like to share. The idea is not to replace the commercial support sites, but to publish those hard-to-find solutions you've found yourself looking for over and over again.

Show all articles