>>>>> "anru" == anru chen <[email protected]> writes:

    anru> Hi: my server is centos (CentOS release 5.6 (Final) ).

    anru> I have a strange problem with mysqli .  the mysqli
    anru> connection only works with command line script , not web
    anru> page script.

    anru> I have fiollowing code inside my php script test.php:

    anru> $connection = mysqli_init();

    anru> mysqli_real_connect($connection,$host,$user,$pass,$database);
    anru> var_dump(mysqli_connect_errno(), mysqli_connect_error());

    anru> so when run that file under command line, it is ok, but in
    anru> web page, it return error code "2003", and error message
    anru> Can't connect to MySQL server on xxxxxx

Try connecting to the same host from command-line, i.e. something like:

  mysql -h $host -u --user=$user --password=$password $database

That works?

-- 
All the best,

Berend de Boer


          ------------------------------------------------------
          Awesome Drupal hosting: https://www.xplainhosting.com/

-- 
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to