mysql_connect won't when run from web server

Matt Graham danceswithcrows at usa.net
Sun May 24 16:10:21 MST 2009


After a long battle with technology, Steven A. DuChene wrote:
>     <?php
>     $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die("Error
> connecting to mysql");

die("can't connect: ".mysql_error()); will give you a little more info about 
what's going wrong.

> $ php testmysqlconnect_script.php
> and it works fine.

Hm.  php-cli and php-web are different packages on many distros, and can do 
things differently.  No one sane would build php-web without MySQL support, 
but it's possible that things aren't set up right in your php.ini.  
That's /etc/php/apache2-php5/php.ini here, YDistroMV.

> Can't connect to MySQL server on 'Mysql' (13) 
> in /home/minime/public_html/testmysqlconnect_script.php on line 6 

Are you running in safe mode?  Is Mysql's mysqld listening on port 3306?  Is 
there any firewall in the way on that port?

-- 
  Dilbert: Not more than ten minutes ago you beat a man senseless.
  Alice:   He was senseless before I beat him.
  My blog: http://crow202.org/wordpress/
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see


More information about the PLUG-discuss mailing list