Oops I catted the wrong file. But the file is exactly the same as mem.php.
[EMAIL PROTECTED] swap]# cat mem.php
<?php
exec("free -b", $data, $result);
$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);
?>
-----Original Message-----
From: Brian Duke [mailto:[EMAIL PROTECTED]
Sent: Friday, April 02, 2004 12:21 AM
To: 'Jason Wong'; [EMAIL PROTECTED]
Subject: RE: [PHP] I think this is a bug...cant use exec commands.
Ok here is my php.ini. directly from /etc/php.ini
; Safe Mode
;
safe_mode = Off
; By default, Safe Mode does a UID compare check when
; opening files. If you want to relax this to a GID compare,
; then turn on safe_mode_gid.
safe_mode_gid = Off
; When safe_mode is on, UID/GID checks are bypassed when
; including files from this directory and its subdirectories.
; (directory must also be in include_path or full path must
; be used when including)
safe_mode_include_dir =
; When safe_mode is on, only executables located in the safe_mode_exec_dir
; will be allowed to be executed via the exec family of functions.
safe_mode_exec_dir = /var/www/html/swap/
I am on a redhat 9.0 machine so I use the locate command after a fresh
updatedb andf this is all the ini files I was talking about.
[EMAIL PROTECTED] swap]# updatedb
[EMAIL PROTECTED] swap]# locate php.ini
/etc/php.ini
/etc/php.ini.rpmsave
/root/php-4.3.4/php.ini-recommended
/root/php.ini.rpmsave
/home/bduke/downloads/php/php-4.3.5/pear/tests/php.ini.tst
/home/bduke/downloads/php/php-4.3.5/php.ini-recommended
/home/bduke/downloads/php/php-4.3.5/php.ini-dist
The php-4.3.5 in not installed yet. I just downloaded it and untarred the
contents in my download directory. We run the program via the web it's for
MRTG graphs. I was using an example I found on the web. Here is the result
when I change line 1 using exec()
[EMAIL PROTECTED] swap]# cat swap.php
<?php
exec("free -b", $data, $result);
$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);
?>
[EMAIL PROTECTED] swap]# php mem.php
sh: line 1: /usr/local/php/bin/free: No such file or directory
[EMAIL PROTECTED] swap]# pwd
/var/www/html/swap
[EMAIL PROTECTED] swap]# ls ./free
./free
[EMAIL PROTECTED] swap]#
The MRTG will call the program via a cgi script. It calls this program only
when the data is requested that way we save on cycle time.
-----Original Message-----
From: Jason Wong
What are these other ini files you've looked at?
How are you executing this script? Via a webserver or directly using the php
executable? If the former use phpinfo() to find out where php thinks it's
php.ini should be found, if the latter use "php -i". Once you've determined
where your php.ini should be examine its safe_mode settings.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php