[CentOS] Unable to lauch php-script to truncate database

Tue Nov 13 10:04:54 UTC 2012
Keith Roberts <keith at karsites.net>

On Mon, 12 Nov 2012, Mark LaPierre wrote:

*snip*

>> or just try to execute the script from an absolute path:
>> [root at caw-server2 jvermeulen]# php
>> /var/www/html/nubuilder/db/reg_bib/cron.php
>> PHP Warning:  include(./config.php): failed to open stream: No such file
>> or directory in /var/www/html/nubuilder/db/reg_bib/cron.php on line 3
>> PHP Warning:  include(): Failed opening './config.php' for inclusion
>> (include_path='.:/usr/share/pear:/usr/share/php') in

*snip*

> Are you changing your active directory to /var/www/html/nubuilder/db in
> your shell script first?  It looks like your shell script is getting a
> listing of that directory and then trying to execute your PHP script in
> that directory which is failing because the parent process that called
> the PHP script is not currently in the directory where the PHP script is
> trying to find the files it is supposed to be working with.  See where
> it says, "failed to open stream: No such file"?

the other thing to bear in mind are:

; open_basedir, if set, limits all file operations to the 
defined directory and below.
; This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file.
; This directive is *NOT* affected by whether Safe Mode is turned On or Off.
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.open-basedir
;open_basedir =

http://www.php.net/manual/en/ini.core.php#ini.include-path

These two directives work together to limit what files you 
allow PHP access to.

BTW - exactly where is the config.php file located you are 
trying to include?

Kind Regards,

Keith

-----------------------------------------------------------
Websites:
http://www.karsites.net
http://www.php-debuggers.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------