I am using PHP 5.0.3 and MySql 4.1.10. PHP works with MySql well as an Apache module. However, when I run php as a CLI script and try to connect to MySql, no sql query seems to be executed (I do not get anything for simple "select * from ..." query). There is no error message either. I actually tried to pass in a none-existing database, invalid username/password when connect to MySql for debug purpose, I still receive no error message. Does someone know what possibly goes wrong? Thanks in advance.

    Just want to clarify my previous post, I can run php CLI script without problem if it does not access MySql (for example, print out "hello world").

      Some distributions compile the CLI version differently from the apache version. Can you get the output of phpinfo() from teh CLI version and see if it has mysql support? If not, you'll need to compile your own...

        The following is the mysql related info from phpinfo(). Is there anything wrong?


        mysql

        MySQL Support => enabled
        Active Persistent Links => 0
        Active Links => 0
        Client API version => 4.1.10a
        MYSQL_MODULE_TYPE => external
        MYSQL_SOCKET => /tmp/mysql.sock
        MYSQL_INCLUDE => -I/usr/local/mysql/include
        MYSQL_LIBS => -L/usr/local/mysql/lib -lmysqlclient

        Directive => Local Value => Master Value
        mysql.allow_persistent => On => On
        mysql.connect_timeout => 60 => 60
        mysql.default_host => no value => no value
        mysql.default_password => no value => no value
        mysql.default_port => no value => no value
        mysql.default_socket => no value => no value
        mysql.default_user => no value => no value
        mysql.max_links => Unlimited => Unlimited
        mysql.max_persistent => Unlimited => Unlimited
        mysql.trace_mode => Off => Off

          Can you connect to the mysql server with some other client?

            What do mean by "some other clients"? PHP connects well with MySql when it runs as an apache module.

              Write a Reply...