Re: I think this is a bug...cant use exec commands.

From: Date: Thu, 01 Apr 2004 13:00:54 +0000
Subject: Re: I think this is a bug...cant use exec commands.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-182013@lists.php.net to get a copy of this message
May be you can look at exec() function: http://www.php.net/manual/en/function.exec.php I know this doesn't solve the problem but gives you an option to workaround the problem. The curious thing about the warning message is: where are the backquotes in your code?? -William El jue, 01-04-2004 a las 01:54, Brian Duke escribió: > I can't seem to use the shell_exec() command. > > Here is the program: > > > > <?php > > > > $data = shell_exec("free -b"); > > $data = str_replace(' ',' ',$data); > > $data = str_replace(' ',' ',$data); > > $data = str_replace(' ',' ',$data); > > $data = str_replace(' ',' ',$data); > > $dataArray = explode(' ',$data); > > > > $total = $dataArray[16]; > > $used = $dataArray[17]; > > > > echo $used.chr(10); > > echo $total.chr(10); > > ?> > > > > I can make this script executable via chmod 700 mem.php and run it directly > via the command line. Only then I can get it to work on my redhat 9 machine. > > The problem is I call this script from another script to plot out the data > on MRTG graphs. > > > > I expect to see something like : > > > > [root@rain php-4.3.2]# php /var/www/html/swap/mem.php > > > > 246789242 > > 512689734 > > > > [root@rain php-4.3.2]# > > > > But in fact I get the warning : > > > [root@rain php-4.3.2]# php /var/www/html/swap/mem.php > > Warning: shell_exec(): Cannot execute using backquotes in Safe Mode in > /var/www/html/swap/swap.php on line 3 > > [root@rain php-4.3.2]# > > The warning would be applicable if any php.ini file on my system had Safe > Mode enabled. As the bug people said shell_exec() == ``. But that applies > if anywhere on my box safemode was enabled. I have spent 4 solid days > looking and verifying there is no safe mode enabled on my box. It's an > internal monitoring server there is absolutely no need for safe mode. This > is what is in my PHP.ini > > > > ; Safe Mode > > ; > > safe_mode = Off > > safe_mode_gid = Off > > > > Can someone tell me if they can run that script on their *nix machine? I'm > running php 4.32 apache 2.0 server on a up-to-date redhat 9 server. I don't > think this script can be run from another program. > > > > >

« previous php.general (#182013) next »