Hi all,,, I'm having hell with this !"§$ PHP safe mode. It seems that SuSE complies PHP with safe mode = on. THEREFORE the config file "php.ini" can not turn it off. Can someone who is using PHP & exec in SuSE 8.2 give me an idea how they are doing it? OR how to work around this. Here is my code: $db = mysql_connect("XXX", "YYYY", "ZZZZZ"); mysql_select_db("WartHog",$db); if (file_exists('AUD.txt')){ exec('euro-update.program') or die ('didnt work #1') ; } else { echo('File not there'); } Thanks, JIM -- Jim Hatridge Linux User #88484 ------------------------------------------------------ BayerWulf Linux System # 129656 The Recycled Beowulf Project Looking for throw-away or obsolete computers and parts to recycle into a Linux super computer Viel Feind -- Viel Ehr' Anti-US Propaganda stamp collecton http://www.fuzzybunnymilitia.org/~hatridge/collection
On Sunday 07 September 2003 15:29, James Hatridge wrote:
I'm having hell with this !"§$ PHP safe mode. It seems that SuSE complies PHP with safe mode = on. THEREFORE the config file "php.ini" can not turn it off. Can someone who is using PHP & exec in SuSE 8.2 give me an idea how they are doing it? OR how to work around this.
Hmm. Not on my copy: /etc/php.ini says: safe_mode = Off and I haven't changed it.
exec('euro-update.program') or die ('didnt work #1') ;
I think you'll need to give the full path to the program, otherwise php won't know where to find it. Also ensure that those are backticks you're using. -- Best wishes Kevin Donnelly www.kyfieithu.co.uk - Meddalwedd Rydd yn Gymraeg
HI Kevin et al, On Monday 08 September 2003 15:31, Kevin Donnelly wrote:
On Sunday 07 September 2003 15:29, James Hatridge wrote:
I'm having hell with this !"§$ PHP safe mode. It seems that SuSE complies PHP with safe mode = on. THEREFORE the config file "php.ini" can not turn it off. Can someone who is using PHP & exec in SuSE 8.2 give me an idea how they are doing it? OR how to work around this.
Hmm. Not on my copy: /etc/php.ini says: safe_mode = Off and I haven't changed it.
exec('euro-update.program') or die ('didnt work #1') ;
I think you'll need to give the full path to the program, otherwise php won't know where to find it. Also ensure that those are backticks you're using.
Ok, I check that and changed it to backticks, it changed the error I got. Now this is happening: ##################### Warning: exec() [function.exec]: Cannot execute a blank command in /home/hatridge/public_html/Database/currency.php on line 22 ####################### Here is the piece of code that is making this error: <?php $db = mysql_connect("XXX", "YYYYYY", "ZZZZZ"); mysql_select_db("WartHog",$db); if (file_exists("/var/lib/mysql/WartHog/AUD.txt")){ exec(`/var/lib/mysql/WartHog/euro-update.program`) or die ('didnt work #1') ; } else { echo('File not there'); } ?> ############################# When I use " " or ' ' I get only "didn't work #1". The euro-update.program is just a small bash file. I've got it running very good at the command line. So I know that it works. If you had a bash file to run, how would you do it? Thanks, JIM -- Jim Hatridge Linux User #88484 ------------------------------------------------------ BayerWulf Linux System # 129656 The Recycled Beowulf Project Looking for throw-away or obsolete computers and parts to recycle into a Linux super computer Viel Feind -- Viel Ehr' Anti-US Propaganda stamp collecton http://www.fuzzybunnymilitia.org/~hatridge/collection
On Tuesday 09 September 2003 12:57, James Hatridge wrote:
Ok, I check that and changed it to backticks, it changed the error I got.
Sorry - I meant backticks if you're just using the command by itself: $return=`program`; echo $return; for instance. If you want to use exec(), you use something like: exec("program",$return); foreach ($return as $line) echo "$line\n"; This should give a printout of the output lines from the $return array, so you can see what the alleged execution is doing. You could also just use passthru("program"); to have the output sent direct to the browser. $return=system("program") is similar. You should probably have a good read of the onsite manual, because there are various user annotations on it. And also be prepared to spend a bit of time exploring what works on your system - in my experience, most PCs are set up slightly differently, because people tend to use their own methods and locations for saved files (eg I personally would not store AUD.txt in the mysql dir). So you may have to keep looking at things like permissions. In particular, the webserver (wwwrun.nogroup in SuSE) may need to be allowed access to the file and to the directory you want it stored in, never mind the dir where the program is. HTH
The euro-update.program is just a small bash file. I've got it running very good at the command line. So I know that it works. If you had a bash file to run, how would you do it?
I know what options I would try, but I approach all these things on the basis that they will never work first time around. It's a bit like getting your bearings in a strange town. -- Best wishes Kevin Donnelly www.kyfieithu.co.uk - Meddalwedd Rydd yn Gymraeg
Hi Kevin et al.... Thanks for your help, but it seems that I'm beating my head against the wall. I got to thinking about it. The problem seems to be that the script does not do anything to PHP or HTML. All it does is updates the db and quits. Anyway I have been looking at other ways to do this. I can set up a cron job to do the script once a day or so, or put it in the boot.local and do it each time I start the system in the morning. One or the other should work. Thanks JIM On Wednesday 10 September 2003 12:57, Kevin Donnelly wrote:
On Tuesday 09 September 2003 12:57, James Hatridge wrote:
Ok, I check that and changed it to backticks, it changed the error I got.
Sorry - I meant backticks if you're just using the command by itself: $return=`program`; echo $return; for instance.
If you want to use exec(), you use something like: exec("program",$return); foreach ($return as $line) echo "$line\n"; This should give a printout of the output lines from the $return array, so you can see what the alleged execution is doing.
You could also just use passthru("program"); to have the output sent direct to the browser. $return=system("program") is similar.
You should probably have a good read of the onsite manual, because there are various user annotations on it. And also be prepared to spend a bit of time exploring what works on your system - in my experience, most PCs are set up slightly differently, because people tend to use their own methods and locations for saved files (eg I personally would not store AUD.txt in the mysql dir). So you may have to keep looking at things like permissions. In particular, the webserver (wwwrun.nogroup in SuSE) may need to be allowed access to the file and to the directory you want it stored in, never mind the dir where the program is.
HTH
The euro-update.program is just a small bash file. I've got it running very good at the command line. So I know that it works. If you had a bash file to run, how would you do it?
I know what options I would try, but I approach all these things on the basis that they will never work first time around. It's a bit like getting your bearings in a strange town.
--
Best wishes
Kevin Donnelly
www.kyfieithu.co.uk - Meddalwedd Rydd yn Gymraeg
-- Jim Hatridge Linux User #88484 ------------------------------------------------------ BayerWulf Linux System # 129656 The Recycled Beowulf Project Looking for throw-away or obsolete computers and parts to recycle into a Linux super computer Viel Feind -- Viel Ehr' Anti-US Propaganda stamp collecton http://www.fuzzybunnymilitia.org/~hatridge/collection
On Thursday 11 September 2003 16:29, James Hatridge wrote:
Thanks for your help, but it seems that I'm beating my head against the wall. I got to thinking about it. The problem seems to be that the script does not do anything to PHP or HTML. All it does is updates the db and quits. Anyway I have been looking at other ways to do this. I can set up a cron job to do the script once a day or so, or put it in the boot.local and do it each time I start the system in the morning. One or the other should work.
The fact that it does nothing in PHP or HTML should not matter. But cron may indeed be a better approach. The one thing I like about a PHP script of this type is that you can then trigger it from another script, over the Net if desired, by running wget on the PHP page. -- Best wishes Kevin Donnelly www.kyfieithu.co.uk - Meddalwedd Rydd yn Gymraeg
participants (2)
-
James Hatridge
-
Kevin Donnelly