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

Tue Nov 13 10:53:51 UTC 2012
Johan Vermeulen <jvermeulen at cawdekempen.be>


Op 13-11-12 11:04, Keith Roberts schreef:
> 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]
> -----------------------------------------------------------
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos

Hello All, Hello Keith,

thanks a million for the responses, I'm already happy to understand 
where the EM are coming from.

The config.php are in each database;

/[root at caw-server2 db]# ls
reg_begeleidingsteam  reg_jww_archief   reg_personeel     reg_straathoekwerk
reg_bib               reg_jww_dossiers  reg_resident      reg_vrijwilligers
reg_drughulp          reg_jww_dvd       reg_signaleren
reg_jac_activiteit    reg_onthaal       reg_sollicitatie/

so for instance reg_bib ( witch has a library ) has config.php :

/[root at caw-server2 reg_bib]# ls
background_logo.jpg    config.php  database.php  index.php
background_stripe.png  cron.php    favicon.ico/

Following your advise, I changed the include enty to :

  include "/var/www/html/nubuilder/db/reg_bib/config.php";

this seems to work without EM, I'm now checking if this indeed truncated 
the files.

again many thanks !

Greetings,J.