PHP scripts can no longer create files
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
php4 (Ubuntu) |
Invalid
|
Medium
|
Adam Conrad |
Bug Description
(This is on x86, Warty with apt-get'ed security updates...)
In the last couple of days, I've had some problems with PHP scripts being unable to
create files in /tmp using fopen() or error_log(). This may be a new problem since the
March 18 security update to some PHP packages; I don't recall having such problems
before this.
This breaks my scripts' installation, debug logs, etc. It also appears to break
installation of PEAR packages with the pear command-line tool.
For instance this PHP script accessed from the web:
<?php $file = fopen("
Gives this error:
Warning: fopen(/
var/www/
If the file is first created and made writable to www-data, it seems to work, but if the
file doesn't exist ahead of time, nothing. /tmp appears to have correct permissions:
drwxrwxrwt 11 root root 4096 2005-03-22 02:00 /tmp
This affects the command-line PHP as well, running under a regular user account:
$ php write-test.php
Warning: fopen(/
var/www/
Even the command-line PEAR package installer tool cannot write files to /tmp and so
cannot download and install packages:
$ sudo pear install XML_Beautifier-1.1
downloading XML_Beautifier-
could not open /tmp/tmpgwHK3B/
PHP's safe_mode and open_basedir restrictions are not on; I even set aside my php.ini
files and reinstalled the php4* and libapache2-mod-php4 packages to make sure I hadn't
accidentally changed some relevant option.
Other directories I create which are writable seem to have the same problem, so it's not
hardcoded to /tmp, world-writableness, or the sticky bit.
PHP package versions I have installed:
ii libapache2-mod-php4 4.3.8-3ubuntu7.5
ii php4-cgi 4.3.8-3ubuntu7.5
rc php4-curl 4.3.8-3ubuntu7
ii php4-dev 4.3.8-3ubuntu7.5
ii php4-domxml 4.3.8-3ubuntu7
rc php4-gd 4.3.8-3ubuntu7
rc php4-ldap 4.3.8-3ubuntu7
ii php4-mysql 4.3.8-3ubuntu7
ii php4-pear 4.3.8-3ubuntu7
rc php4-xslt 4.3.8-3ubuntu7
This bug has been marked as a duplicate of bug 14355.