Re: [PHP] HELP problems running PHP4 script in CRON
I think your troubles are that you need a #!/path/to/php or you can start it with php -f file.php Julia Quoting Splashy ([EMAIL PROTECTED]): Hi, Please find script below and hopefully tell me why when I run it over the web it works perfectly but when I run it using cron or in a telnet session it errors saying no such file or directory. THIS IS THE ERROR /* ./fetch_news.php: ?: No such file or directory ./fetch_news.php: syntax error near unexpected token `fetchnews($mysourcefile,$m youtputfile,$myflashvar)' */ THIS IS THE SCRIPT ? #Requires 3 Params #$mysourcefile = path to content source html file #$myoutputfile = path to content output html file #$myflashvar = Flash variable you wish to assign the content to eg:mynews, mytechnology function fetchnews($mysourcefile,$myoutputfile,$myflashvar) { $mysource=fopen($mysourcefile,r) or die (Couldn't open the Source file); $myoutput=fopen($myoutputfile,w) or die (Couldn't open the Output file);; fwrite($myoutput,$myflashvar); while (!feof($mysource)) { $myline=fgets($mysource, 1024); $stripquotes=eregi_replace(#039,`,$myline); $stripcolors=eregi_replace(COLOR=\#.*\,,$myline); if (eregi('^a.*\/abr',$stripcolors)) { $newanchor=eregi_replace(br,,$stripcolors); fwrite($myoutput,$newanchorbr); } } fclose($myoutput); fclose($mysource); } ? ? fetchnews(http://www.moreover.com/cgi-local/page?c=Graphics%20industry%20ne wso=html,graphicsnews.php,mynews=); ? All help and advise is as always gratefully received! Splashy. -- [ Julia Anne Case ] [Ships are safe inside the harbor, ] [Programmer at large] [ but is that what ships are really for.] [ Admining Linux ] [ To thine own self be true. ] [ Windows/WindowsNT ] [ Fair is where you take your cows to be judged. ]
RE: [PHP] HELP problems running PHP4 script in CRON
At the top, put: #!/path/to/php -q ? ...code... ? The reason itsgiving you those errors is because it doesnt no what interpreter to use for the script. Of course, your going to have to have the standalone binary of php built, not the apache module. On a side note, does anyone know if you can get php to build both at the same time? The binary and the .so module? At the moment, I just have to compile twice. Ray Hilton - [EMAIL PROTECTED] http://rayh.co.uk -Original Message- From: Splashy [mailto:[EMAIL PROTECTED]] Sent: 19 June 2001 15:29 To: [EMAIL PROTECTED] Subject: [PHP] HELP problems running PHP4 script in CRON Hi, Please find script below and hopefully tell me why when I run it over the web it works perfectly but when I run it using cron or in a telnet session it errors saying no such file or directory. THIS IS THE ERROR /* ./fetch_news.php: ?: No such file or directory ./fetch_news.php: syntax error near unexpected token `fetchnews($mysourcefile,$m youtputfile,$myflashvar)' */ THIS IS THE SCRIPT ? #Requires 3 Params #$mysourcefile = path to content source html file #$myoutputfile = path to content output html file #$myflashvar = Flash variable you wish to assign the content to eg:mynews, mytechnology function fetchnews($mysourcefile,$myoutputfile,$myflashvar) { $mysource=fopen($mysourcefile,r) or die (Couldn't open the Source file); $myoutput=fopen($myoutputfile,w) or die (Couldn't open the Output file);; fwrite($myoutput,$myflashvar); while (!feof($mysource)) { $myline=fgets($mysource, 1024); $stripquotes=eregi_replace(#039,`,$myline); $stripcolors=eregi_replace(COLOR=\#.*\,,$myline); if (eregi('^a.*\/abr',$stripcolors)) { $newanchor=eregi_replace(br,,$stripcolors); fwrite($myoutput,$newanchorbr); } } fclose($myoutput); fclose($mysource); } ? ? fetchnews(http://www.moreover.com/cgi-local/page?c=Graphics%20industry% 20ne wso=html,graphicsnews.php,mynews=); ? All help and advise is as always gratefully received! Splashy.
RE: [PHP] HELP problems running PHP4 script in CRON
try using full paths to your files. -Original Message- From: Splashy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, June 19, 2001 9:29 AM To: [EMAIL PROTECTED] Subject: [PHP] HELP problems running PHP4 script in CRON Hi, Please find script below and hopefully tell me why when I run it over the web it works perfectly but when I run it using cron or in a telnet session it errors saying no such file or directory. THIS IS THE ERROR /* ./fetch_news.php: ?: No such file or directory ./fetch_news.php: syntax error near unexpected token `fetchnews($mysourcefile,$m youtputfile,$myflashvar)' */ THIS IS THE SCRIPT ? #Requires 3 Params #$mysourcefile = path to content source html file #$myoutputfile = path to content output html file #$myflashvar = Flash variable you wish to assign the content to eg:mynews, mytechnology function fetchnews($mysourcefile,$myoutputfile,$myflashvar) { $mysource=fopen($mysourcefile,r) or die (Couldn't open the Source file); $myoutput=fopen($myoutputfile,w) or die (Couldn't open the Output file);; fwrite($myoutput,$myflashvar); while (!feof($mysource)) { $myline=fgets($mysource, 1024); $stripquotes=eregi_replace(#039,`,$myline); $stripcolors=eregi_replace(COLOR=\#.*\,,$myline); if (eregi('^a.*\/abr',$stripcolors)) { $newanchor=eregi_replace(br,,$stripcolors); fwrite($myoutput,$newanchorbr); } } fclose($myoutput); fclose($mysource); } ? ? fetchnews(http://www.moreover.com/cgi-local/page?c=Graphics%20industry%20ne wso=html,graphicsnews.php,mynews=); ? All help and advise is as always gratefully received! Splashy.
[PHP] HELP problems running PHP4 script in CRON
Hi, Please find script below and hopefully tell me why when I run it over the web it works perfectly but when I run it using cron or in a telnet session it errors saying no such file or directory. THIS IS THE ERROR /* ./fetch_news.php: ?: No such file or directory ./fetch_news.php: syntax error near unexpected token `fetchnews($mysourcefile,$m youtputfile,$myflashvar)' */ THIS IS THE SCRIPT ? #Requires 3 Params #$mysourcefile = path to content source html file #$myoutputfile = path to content output html file #$myflashvar = Flash variable you wish to assign the content to eg:mynews, mytechnology function fetchnews($mysourcefile,$myoutputfile,$myflashvar) { $mysource=fopen($mysourcefile,r) or die (Couldn't open the Source file); $myoutput=fopen($myoutputfile,w) or die (Couldn't open the Output file);; fwrite($myoutput,$myflashvar); while (!feof($mysource)) { $myline=fgets($mysource, 1024); $stripquotes=eregi_replace(#039,`,$myline); $stripcolors=eregi_replace(COLOR=\#.*\,,$myline); if (eregi('^a.*\/abr',$stripcolors)) { $newanchor=eregi_replace(br,,$stripcolors); fwrite($myoutput,$newanchorbr); } } fclose($myoutput); fclose($mysource); } ? ? fetchnews(http://www.moreover.com/cgi-local/page?c=Graphics%20industry%20ne wso=html,graphicsnews.php,mynews=); ? All help and advise is as always gratefully received! Splashy.