Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I try to run a script from the command line, a script made by zend framework. I used also the Zend Server who has her own php.ini. When I try to start my script on the command line I am not able to connect with my mysql database. It's because from the command line it takes (it has to be) another php.ini file located somewhere on my Mac OS X Lion system because the path to the mysql.sock isnt the path who is configurated in the zend server php.ini.

I would like to let the command line use my php.ini of zend Server.

I hope someone knows how to do this.

Kind regards, Nicky

share|improve this question
up vote 2 down vote accepted

You can launch php from the command line with an option to specific the path where the php.ini file you want it to use is located:

php -c /path/to/zend/phpini/folder myfile.php

To find out the the folder where the command line php.ini is located, you can use:

php -i | grep php.ini
share|improve this answer
Thank you that works! But I get a lot of Warnings, like "Failed loading /usr/local/zend/lib/ dlopen(/usr/local/zend/lib/, 9): no suitable image found. Did find: /usr/local/zend/lib/ mach-o, but wrong architecture PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/' - dlopen(/usr/local/zend/lib/php_extensions/, 9): no suitable image found. Did find: /usr/local/zend/lib/php_extensions/ mach-o, but wrong architecture in Unknown on line 0" Normal? – user968898 Dec 6 '11 at 10:44
Looks like Zend Server also has its own PHP version, while on the command line you are using the PHP version that comes with Mac OS X. Instead of calling plain php, you'll have to specify the full path to the PHP executable like this: /path/to/zend/bin/php. It'll probably use the right php-init without you having to use th -c parameter. – chiborg Dec 30 '15 at 12:53
You can also find ini files with php --ini – joelpittet Jun 29 at 21:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .