Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
March 20, 2008, 3:34 pm
rate this thread
or die("Not able to connect to <b>$db_host");
// Data base select
or die ("Not able to select db $basedb<br>");
echo "Print check<br>";
works if running from browser.
When I try to run the same script from command line:
I get the following error message:
Warning: mysql_connect(): Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2) in
/home/stefano/htdocs/lust/main/test1.php on line 3
Not able to connect to <b>stefano@stefano-desktop:~/htdocs/lust/main$
It is one day I am working around that problem. Do you have any idea ?
Re: Simple PHP code works with browser - not with command line
Right. The web server is running in /opt/lampp and the file
/var/run/mysqld/mysqld.sock does not exist.
There is the following: /opt/lampp/var/mysql/mysql.sock (please note:
mysql.sock, NOT mysqld.sock).
I suppose it is due to the fact that I have installed the packet xampp for
Linux first, and THEN the command line interpreter php5-cli.
How can I solve ?