Web Hosting Talk







View Full Version : PHP do not write in tmp!!! Heeeelp!


Lupin
07-11-2001, 12:43 PM
Hi,
I got a biiiig problem... dozen of expert (they say to be so) couldn't help me... lets try here :)

I got a php script that have to write in the dir tmp. But, when I use it I get this error:

Warning: SAFE MODE Restriction in effect. The script whose uid is 10044 is not allowed to access /tmp/phpoOGHiO owned by uid 0
------
and
------
Warning: fopen("/tmp/phpoOGHiO","r") - Success
------
and
------
Warning: Supplied argument is not a valid File-Handle resource


I know what it means but I do not know what to do to let 10044 access in tmp...
I've 3 virtual hosts with different scripts that have the same problem...

Please save me :)
Thanks

Lp

freakysid
07-11-2001, 02:28 PM
To turn safe_mode OFF, in your php.ini file you have to set:

safe_mode = Off


You should read up on the security issues this poses in a shared virtual server environment. There are some other options you can set to restrict what environment variables users can set when safe_mode is OFF such as safe_mode_exec_dir but I have no knowledge or experience in this.

Lupin
07-11-2001, 03:24 PM
Thanks...
but we've already checked it.

It's OFF but it doesn't work...

Lp

freakysid
07-11-2001, 03:50 PM
I know this is a stupid question (but I've done this). You are editing the correct version of php.ini on your system, and not some other backed up or duplicate file? This happened because I recompiled php and ended up with php.ini files in different locations.

Annette
07-11-2001, 03:57 PM
If the definition of that location is in the configuration file for the script itself, why don't you just rewrite that portion of the script to write to some other directory under your own account, where you can give it the permissions that you want?

Lupin
07-11-2001, 04:44 PM
freakysid:
yes, we are editing the right version because we are working on httpd.conf file of apache... php is in a module compiled in it

Annette:
PHP need to use tmp directory.
we have several sites that need it. We really got to solve that problem.

I'm reading all of our book and manual looking for some faq or suggest... until now notthing...

Thanks anyway... This forum is really usefull... :)))

ffeingol
07-11-2001, 05:02 PM
I know it sounds real silly, but did you create a phpinfo page and verify that safemode is off?

Frank

Annette
07-11-2001, 06:08 PM
Originally posted by Lupin
freakysid:
yes, we are editing the right version because we are working on httpd.conf file of apache... php is in a module compiled in it

Annette:
PHP need to use tmp directory.
we have several sites that need it. We really got to solve that problem.

I'm reading all of our book and manual looking for some faq or suggest... until now notthing...

Thanks anyway... This forum is really usefull... :)))

php probably does already use /tmp (at least it will with most standard php installations). It looks more like your script is unable to write to /tmp ("I got a php script that have to write in the dir tmp. But, when I use it I get this error:"), which is easy enough to fix - tell it to write somewhere else, and modify the directory permissions appropriately. We've done it in the past with phpNuke and vB sites for our clients on systems where /tmp is restricted to system users only, and it's better than beating your head against a wall.

Lupin
07-12-2001, 04:29 AM
Thanks Annette but we have the same problem with other 3 we sites... with different scripts.

We got to solve this problem on the server side.

...

Yes Frank, safe mode is off...

We are getting crazy...

Lp

WebSnail.net
07-12-2001, 06:44 AM
Ok, please note that this is a WAG (wild assed guess) so please treat it accordingly...

Suggestion #1:
Try checking the output for php using phpinfo() and note the expected location of php.ini. In my case I found it hadn't been created. If not get the default version, put it where it belongs and check the settings... then restart the server.

Suggestion #2:
As Annette suggested check the permissions for the tmp directory. also check what user/group you are running Apache under. No idea (yet) how this would affect things but it's may've worth a look.

Suggestion #3:
Try recompiling the PHP module... it might solve the problem.

Yeah.. I know probably useless and may'be already tried but at the moment I've no better ideas.

Fingers crossed

MattF
07-12-2001, 07:27 AM
Use


<?

phpinfo();

?>


to see where your php.ini is located, sometimes its located in /usr/local/php/php.ini rather than /etc/php.ini even though the file appears there as well.

Edit php.ini, restart apache, and monitor for errors in Apache (if using mod_php) upon loading the new configuration and when executing the script. 'more /usr/local/apache/logs/error_log'

Make sure its not a permissions problem, whilst troubleshooting maybe set the directory to 777.

Lupin
07-13-2001, 03:38 AM
Thanks everybody!!! :D

I got the solution!

Incredible, the server we are using do not let the single users (virtual hosts) to create or acces or work with any directory out off their "virtual root dir".

That's it.

Annette was right, we have to modify the script. It's the one solution.

Thanks and "see" you soon :cartman:

:: Lp ::