open_basedir issue for same user when running script from cron after suphp install

roly

Verified User
Joined
Nov 9, 2006
Messages
197
hi

i've just upgraded php from 5.2 cli to 5.3 cgi suphp all is fine except that a script i run from root user cron is giving an open_basedir error even though the includes the scrpit is calling for are all in the same users directory's.

the user in question has his own php.ini for that user which has
Code:
open_basedir = /home/admin9/:/tmp/

but the error i'm getting when the cron runs the script is:

Code:
PHP Warning:  chdir(): open_basedir restriction in effect. File(/home/admin9/domains/domain.com/public_html/gen) is not within the allowed path(s): (/var/www/html/:/tmp/) in /home/admin9/domains/domain.com/public_html/gen/runcrawl.php(2) : eval()'d code on line 9 PHP Warning:  include(): open_basedir restriction in effect. File(./index.php) is not within the allowed path(s): (/var/www/html/:/tmp/) in /home/admin9/domains/domain.com/public_html/gen/runcrawl.php(2) : eval()'d code on line 12 PHP Warning:  include(./index.php): failed to open stream: Operation not permitted in /home/admin9/domains/domain.com/public_html/gen/runcrawl.php(2) : eval()'d code on line 12 PHP Warning:  include(): open_basedir restriction in effect. File(./index.php) is not within the allowed path(s): (/var/www/html/:/tmp/) in /home/admin9/domains/domain.com/public_html/gen/runcrawl.php(2) : eval()'d code on line 12 PHP Warning:  include(./index.php): failed to open stream: Operation not permitted in /home/admin9/domains/domain.com/public_html/gen/runcrawl.php(2) : eval()'d code on line 12 PHP Warning:  include(): Failed opening './index.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/admin9/domains/domain.com/public_html/gen/runcrawl.php(2) : eval()'d code on line 12

which is saying allowed paths are only:

/var/www/html/:/tmp/

and not

/home/admin9/:/tmp/

which it says in his own user specific php.ini

if anyone has any idea what the issue is any advice would be appreciated.

thanks in advance
 
Hello,

PHP scripts executed with cron does not use custom php.ini (set on per user bases). It uses system default php.ini

For now I'm working on the issue, as I faced the same. But I haven't test it with PHP 5.3 yet.
 
thanks for the reply, you may already be aware of this, but i've found a solution on a different thread and that is to add the php.ini location in the cron entry like this:

/usr/local/bin/php -c /usr/local/directadmin/data/users/user10/php/php.ini /home/user10/domains/donmain.com/public_html/gen/script.php

i've tested this and it work fine

thanks again
 
Yes, I know about that. But I want to get a little more.

You also can put it in your script:

PHP:
#!/usr/local/bin/php -c /usr/local/directadmin/data/users/user10/php/php.ini
<?
// ....
?>
 
Thnaks, i've actually switched back to cli with mod_ruid2 now. the load increase using suphp was huge on my server.
 
yes that's what i'm using and load back to normal. thanks for your help :)
 
Back
Top