PHP scripts can no longer create files

Bug #14386 reported by Brion Vibber
8
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("/tmp/doesnt.exist", "wt" ); ?>

Gives this error:
Warning: fopen(/tmp/doesnt.exist): failed to open stream: No such file or directory in /
var/www/write-test.php on line 1

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(/tmp/doesnt.exist): failed to open stream: No such file or directory in /
var/www/write-test.php on line 1

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-1.1.tgz ...
could not open /tmp/tmpgwHK3B/XML_Beautifier-1.1.tgz for writing

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

Revision history for this message
Adam Conrad (adconrad) wrote :

This bug has been marked as a duplicate of bug 14355.

Revision history for this message
Chris Wagner (chris-wagner) wrote :

Is this still a problem for you Brion?

Revision history for this message
Chris Wagner (chris-wagner) wrote :

Oh, sorry; I now see that this report is marked as a duplicate. :)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.