On 14 June 2010 21:58, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
On Mon, 2010-06-14 at 21:36 +0530, Ferdi wrote:
Hi list,
My config is XAMPP 1.7.2 with PHP 5.3.0
I'm trying to run a php script as a cron job. The same script works
perfectly from the browser, but fails when I try it from the command line
(not yet set it up as cron).
I get the following error:
PHP Fatal error: Call to undefined function mysql_connect() in
/opt/lampp/htdocs/CS/weekly_email_report.php on line 3
I tried using dl('mysql.so') before the mysql_connect, but to no avail, I
get:
PHP Warning: dl(): Unable to load dynamic library
'/usr/lib/php/modules/mysql.so' - /usr/lib/php/modules/mysql.so: cannot open
shared object file: No such file or directory in
/opt/lampp/htdocs/CS/weekly_email_report.php on line 2
PHP Fatal error: Call to undefined function mysql_connect() in
/opt/lampp/htdocs/CS/weekly_email_report.php on line 3
In general many functions that work when the page is accessed from the
browser, fail on the command line. I tried setting extension=mysql.so in
both the php.ini files (the one used by the web server and the one used by
the command line (/etc/php.ini, correct??), though not simultaneously)
Any pointers??
TIA
Ferdi
It sounds that maybe you have two different setups of PHP or that the CLI
isn't using the same php.ini as the server module. What happens if you run a
phpinfo() from the CLI? Do you get the output you expect? You should see the
php.ini location as being the same as the server module. If not, you can
pass the location of the php.ini in with the command line arguments.
If you have two different installations of PHP (which some people tend to
do) then you might need to make sure the right modules are installed on
both.
Try the ini thing first and see if that fixes the issue.
Thanks,
Ash
http://www.ashleysheridan.co.uk
Hi List,
When I read Ashley's reply, I figured why not use the other php interpreter?
The one the web server uses? It worked :-). Thanks Ashley.
Just for academic interest, I have put up the output of phpinfo I get with
the command line php interpreter at pastebin. This still does not work, but
that's immaterial now.
Find it at: http://pastebin.com/XL50eBFm
Regards,
Ferdi