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

2012-11-12 Thread Johan Vermeulen
Dear All,

we have some Nubuilder databases on a Centos6.3 server:

[root@caw-server2 db]# ls /var/www/html/nubuilder/db
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_activiteitreg_onthaal   reg_sollicitatie

in each database I have placed a executable file cron.php

---

0)
 {
   while($row=mysql_fetch_row($result))
   {
 if(substr($row[0], 0, 3) === '___' && strrev(substr($row[0], 0, 
3) === '___'))
 {
 $sql = "DROP TABLE $row[0]";
 mysql_query($sql);
 }
   }
 }
?>

--

for each file I can easily execute the file cron.php :

[root@caw-server2 reg_bib]# php cron.php

with the desired effect.

*However *when I try to execute the cron.php files from a script :



#!/bin/bash
for i in `ls /var/www/html/nubuilder/db`
do
php /var/www/html/nubuilder/db/$i/cron.php
done
exit 0

--

or just try to execute the script from an absolute path:
[root@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 
/var/www/html/nubuilder/db/reg_bib/cron.php on line 3
PHP Notice:  Undefined variable: DBHost in 
/var/www/html/nubuilder/db/reg_bib/cron.php on line 4
PHP Notice:  Undefined variable: DBUser in 
/var/www/html/nubuilder/db/reg_bib/cron.php on line 4
PHP Notice:  Undefined variable: DBPassword in 
/var/www/html/nubuilder/db/reg_bib/cron.php on line 4

I get a shipload of EM.

I don't understand why this works but not from an absolute path.

Any help would be greatly appreciated.

greetings, J.

-- 
Johan Vermeulen
IT-medewerker
Caw De Kempen
johan.vermeu...@cawdekempen.be


Opensource Software is the future.

___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


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

2012-11-12 Thread Johnny Hughes
On 11/12/2012 12:38 PM, Johan Vermeulen wrote:
> Dear All,
>
> we have some Nubuilder databases on a Centos6.3 server:
>
> [root@caw-server2 db]# ls /var/www/html/nubuilder/db
> 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_activiteitreg_onthaal   reg_sollicitatie
>
> in each database I have placed a executable file cron.php
>
> ---
>
> 
>include "./config.php"; //nuBuilder config file
>  $conn = mysql_connect($DBHost, $DBUser, $DBPassword);
>  mysql_select_db($DBName,$conn);
>
>  /**
>  emptying zzsys_trap and zzsys_variable tables
>  **/
>$sql = "TRUNCATE TABLE zzsys_trap";
>mysql_query($sql);
>$sql = "TRUNCATE TABLE zzsys_variable";
>mysql_query($sql);
>
>  /**
>  Deleting temp tables
>  **/
>  $result=mysql_query("SHOW TABLES FROM $DBName ") or die(mysql_error());
>  if(mysql_num_rows($result)>0)
>  {
>while($row=mysql_fetch_row($result))
>{
>  if(substr($row[0], 0, 3) === '___' && strrev(substr($row[0], 0, 
> 3) === '___'))
>  {
>  $sql = "DROP TABLE $row[0]";
>  mysql_query($sql);
>  }
>}
>  }
> ?>
>
> --
>
> for each file I can easily execute the file cron.php :
>
> [root@caw-server2 reg_bib]# php cron.php
>
> with the desired effect.
>
> *However *when I try to execute the cron.php files from a script :
>
> 
>
> #!/bin/bash
> for i in `ls /var/www/html/nubuilder/db`
> do
> php /var/www/html/nubuilder/db/$i/cron.php
> done
> exit 0
>
> --
>
> or just try to execute the script from an absolute path:
> [root@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 
> /var/www/html/nubuilder/db/reg_bib/cron.php on line 3
> PHP Notice:  Undefined variable: DBHost in 
> /var/www/html/nubuilder/db/reg_bib/cron.php on line 4
> PHP Notice:  Undefined variable: DBUser in 
> /var/www/html/nubuilder/db/reg_bib/cron.php on line 4
> PHP Notice:  Undefined variable: DBPassword in 
> /var/www/html/nubuilder/db/reg_bib/cron.php on line 4
>
> I get a shipload of EM.
>
> I don't understand why this works but not from an absolute path.
>
> Any help would be greatly appreciated.
>
> greetings, J.
>

include "./config.php";<==that is only working from within the correct 
directory





signature.asc
Description: OpenPGP digital signature
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


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

2012-11-12 Thread Keith Roberts
On Mon, 12 Nov 2012, Johan Vermeulen wrote:

> To: CentOS mailing list 
> From: Johan Vermeulen 
> Subject: [CentOS] Unable to lauch php-script to truncate database
> 
> Dear All,
>
> we have some Nubuilder databases on a Centos6.3 server:
>
> [root@caw-server2 db]# ls /var/www/html/nubuilder/db
> 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_activiteitreg_onthaal   reg_sollicitatie
>
> in each database I have placed a executable file cron.php
>
> ---
>
> 
>   include "./config.php"; //nuBuilder config file
> $conn = mysql_connect($DBHost, $DBUser, $DBPassword);
> mysql_select_db($DBName,$conn);
>
> /**
> emptying zzsys_trap and zzsys_variable tables
> **/
>   $sql = "TRUNCATE TABLE zzsys_trap";
>   mysql_query($sql);
>   $sql = "TRUNCATE TABLE zzsys_variable";
>   mysql_query($sql);
>
> /**
> Deleting temp tables
> **/
> $result=mysql_query("SHOW TABLES FROM $DBName ") or die(mysql_error());
> if(mysql_num_rows($result)>0)
> {
>   while($row=mysql_fetch_row($result))
>   {
> if(substr($row[0], 0, 3) === '___' && strrev(substr($row[0], 0,
> 3) === '___'))
> {
> $sql = "DROP TABLE $row[0]";
> mysql_query($sql);
> }
>   }
> }
> ?>
>
> --
>
> for each file I can easily execute the file cron.php :
>
> [root@caw-server2 reg_bib]# php cron.php
>
> with the desired effect.
>
> *However *when I try to execute the cron.php files from a script :
>
> 
>
> #!/bin/bash
> for i in `ls /var/www/html/nubuilder/db`
> do
> php /var/www/html/nubuilder/db/$i/cron.php
> done
> exit 0
>
> --
>
> or just try to execute the script from an absolute path:
> [root@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

Hello Johan.

Looks like you are trying to include files outside of your 
include_path settings as above.

To include a php file, it has to be within the paths set in 
the include_path directive.

Try changing your include path to the following:

include_path='.:/usr/share/pear:/usr/share/php:/var/www/html/nubuilder/db'

see if that does the trick.

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@centos.org
http://lists.centos.org/mailman/listinfo/centos


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

2012-11-12 Thread Mark LaPierre
On 11/12/2012 01:38 PM, Johan Vermeulen wrote:
> Dear All,
>
> we have some Nubuilder databases on a Centos6.3 server:
>
> [root@caw-server2 db]# ls /var/www/html/nubuilder/db
> 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_activiteitreg_onthaal   reg_sollicitatie
>
> in each database I have placed a executable file cron.php
>
> ---
>
> 
> include "./config.php"; //nuBuilder config file
>   $conn = mysql_connect($DBHost, $DBUser, $DBPassword);
>   mysql_select_db($DBName,$conn);
>
>   /**
>   emptying zzsys_trap and zzsys_variable tables
>   **/
> $sql = "TRUNCATE TABLE zzsys_trap";
> mysql_query($sql);
> $sql = "TRUNCATE TABLE zzsys_variable";
> mysql_query($sql);
>
>   /**
>   Deleting temp tables
>   **/
>   $result=mysql_query("SHOW TABLES FROM $DBName ") or die(mysql_error());
>   if(mysql_num_rows($result)>0)
>   {
> while($row=mysql_fetch_row($result))
> {
>   if(substr($row[0], 0, 3) === '___'&&  strrev(substr($row[0], 0,
> 3) === '___'))
>   {
>   $sql = "DROP TABLE $row[0]";
>   mysql_query($sql);
>   }
> }
>   }
> ?>
>
> --
>
> for each file I can easily execute the file cron.php :
>
> [root@caw-server2 reg_bib]# php cron.php
>
> with the desired effect.
>
> *However *when I try to execute the cron.php files from a script :
>
> 
>
> #!/bin/bash
> for i in `ls /var/www/html/nubuilder/db`
> do
> php /var/www/html/nubuilder/db/$i/cron.php
> done
> exit 0
>
> --
>
> or just try to execute the script from an absolute path:
> [root@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
> /var/www/html/nubuilder/db/reg_bib/cron.php on line 3
> PHP Notice:  Undefined variable: DBHost in
> /var/www/html/nubuilder/db/reg_bib/cron.php on line 4
> PHP Notice:  Undefined variable: DBUser in
> /var/www/html/nubuilder/db/reg_bib/cron.php on line 4
> PHP Notice:  Undefined variable: DBPassword in
> /var/www/html/nubuilder/db/reg_bib/cron.php on line 4
>
> I get a shipload of EM.
>
> I don't understand why this works but not from an absolute path.
>
> Any help would be greatly appreciated.
>
> greetings, J.
>


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"?



-- 
 _
°v°
   /(_)\
^ ^  Mark LaPierre
Registerd Linux user No #267004
https://linuxcounter.net/

___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


[CentOS] Please help -- centos 5.8: does the slapcat still breaks ldap data integrity?

2012-11-12 Thread Gelen James
Hi all,

 I've a small project to backup and restore openldap servers online on centos 
5.8. Basically I don't have the luxury to shutdown the ldap server, then backup 
whole /var/lib/ldap/, but have to backup online with slapcat or similar command 
line tool.

The major concern of using slapcat is the warning below, which was excerpt from 
link 
http://www.centos.org/docs/5/html/5.1/Deployment_Guide/s1-ldap-daemonsutils.html

 You must stop slapd by issuing the /sbin/service ldap stop command before 
using slapadd, slapcat or slapindex. Otherwise, the integrity of the LDAP 
directory is at risk.
Does the limitation of slapcat -- stop ldap first -- still exist? Please shed a 
light onto this. Thanks.

--Guolin
___
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos