On 13 Sep 2003 at 17:26, James Hatridge wrote:

> HI gang!

Hi!

> I am trying to do a mysql update. I wrote a small bash file that works fine at 
> the command line. But I would like to have it ran by PHP whenever I start the 
> DB. What I am trying to do is have PHP check if a new update file is there 
> (AUD.txt) if it is run the "euro-update.program". But I'm getting either 
> nothing or errors. see below....
> 
> #######################
> 
> 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`)      

Here's the problem.
Your euro-update.program is already executed through the inverted 
commas.
And then the exec-function tries to execute the return value from 
your program. And so you get the exec-warning, cause it doesn't know 
what to execute.


>       or die ('didnt work #1') ;
>         }
> else
>         {
>         echo('File not there');
>         }
> 
> ?>
> #############################
> 
> Running the code as is I get this error:
> 
> Warning: exec() [function.exec]: Cannot execute a blank command in 
> /home/hatridge/public_html/Database/currency.php on line 22
> 
> #####################
> 
> When I use " " or ' ' around the program name  I get only "didn't work #1". 

Then you perhaps don't have the right to execute it.
Note that the apache-user must have the execution right on that file.


> Any ideas?

Yes, see above. ;)

> 
> Thanks!
> 
> JIM

HTH,

Simon

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to