When running a script from the command line, it cannot access the PHP extensions enabled with Zend Server.

Follow

Issue

When running a script from the command line, it cannot access the PHP extensions enabled with Zend Server.

Environment

Zend Server (installed)

Running script from CLI

Linux

Windows

OS X

Resolution

Verify that the extension is loaded in the Zend Server UI under Overview > Server Info

Check which executable is being used to run the script.  The file should be located in Zend Server's bin directory:

  • Linux and OS X:
    $ which php
    /usr/local/zend/bin/php
  • Windows:
    C:\> where php
    C:\Program Files (x86)\Zend\ZendServer\bin\php.exe

Ensure that the appropriate php.ini file is loaded.  The correct file should be etc/php.ini in Zend Server's install directory.

  • Linux and OS X:
    $ /usr/local/zend/bin/php --info | grep "Loaded Configuration File"
    Loaded Configuration File => /usr/local/zend/etc/php.ini
  • Windows
    C:\>php --info | find "Loaded Configuration File"
    Loaded Configuration File => C:\Program Files (x86)\Zend\ZendServer\etc\php.ini

Details

If multiple installations are on the system, the wrong executable may be in use.  If the correct executable is in use, it's still possible that the wrong php.ini is being loaded.

Have more questions? Submit a request

Comments

Powered by Zendesk