I hope you are fine today. I have a weird problem. I recently changed my web apps to use mysqli to connect to mysql instead of mysql_connect. When server by apache, everything goes fine and queries are sent properly.
However, when executing php scripts in the terminal, I get the following error:
Error 2002: No such file or directory
I checked the socket files in the php56/php.ini, and the socket is properly declared.
mysqli.default_socket=/opt/local/var/run/mysql55/mysqld.sock
However, in shell, php socket is wrong. Somehow the socket path changes from apache to the terminal php environment and I am completely lost. What php.ini configuration file is usin
me@MacBook-Pro /Users/me/www$ php -i | grep mysqli
mysqli
mysqli.allow_local_infile => On => On
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => /var/mysql/mysql.sock => /var/mysql/mysql.sock
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.reconnect => Off => Off
API Extensions => mysqli,pdo_mysql,mysql
Inside the shell, the configuration file is not properly addressed. Why?
me@MacBook-Pro /Users/me/www$ php -i | grep ini
Configuration File (php.ini) Path => /etc
However, when served by apache the ini file and socket are fine.
Please help :-P I am using macports on macosx. Thanks!