PDA

View Full Version : A strange problem of PHP safe_mode...



tomy
July 27th, 2002, 01:10
Following is what in my php.ini:
safe_mode = On
safe_mode_exec_dir = /usr/bin
safe_mode_include_dir = /usr/lib

Safe_mode_exec_dir and safe_mode_include_dir has included all the files of NetPBM-Progs RPM package.But I couldn't exec the giftopnm(one of the NetPBM-Progs' tools and has set to 755) in PHP,the return code of exec is 99.But when I copy the "ls" from /bin to /usr/bin, I can exec the "ls" which in /usr/bin successfully.

When I turn the Safe_mode Off, Giftopnm can be exec without any problem...

What's wrong with the PHP SafeMode? Or NetPBM-Progs? Thx.

nag
July 31st, 2002, 04:45
Originally posted by tomy
Following is what in my php.ini:
safe_mode_exec_dir = /usr/bin

But when I copy the "ls" from /bin to /usr/bin, I can exec the "ls" which in /usr/bin successfully.
What's wrong with the PHP SafeMode? Or NetPBM-Progs? Thx.
Nothing is wrong ,when you executed "ls" from /usr/bin it executed successfully because you have told PHP to execute files from /usr/bin in your "php.ini".To execute other files you must have permissions ,if you want to run it from /bin then chmod it 777.I hope it would work!

tomy
July 31st, 2002, 11:59
Thx nag, but , I think 755 is enough for everyone to execute it...
777 is too dangerous...:p

anyway,thx nag. :)