phpapacheubuntuzend-server

Zend Server 8 PDO could not find driver via CLI


I installed Zend Server 8, and I need to run scripts that use MySQL via the command line.

I get this error when I run one of my CLI scripts:

 PDOException
 could not find driver

But everything works via http, problem only occurs in CLI. I know there is a different php.ini for the CLI. However, when i reference the php.ini that the server uses for http like this:

php -c/usr/local/zend/etc/php.ini my-script

I get this:

    Warning: PHP Startup: Unable to load dynamic library 

    /usr/local/zend/lib/php_extensions/pdo.so' - 
    /usr/local/zend/lib/php_extensions/pdo.so: 
    cannot open shared object file: 
    No such file or directory in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library /usr/local/zend/lib/php_extensions/readline.so' - /usr/local/zend/lib/php_extensions/readline.so: 
cannot open shared object file: 
No such file or directory in Unknown on line 0

Fatal error: Class 'PDO' not found in /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php on line 155

I have no idea how to troubleshoot this. I use Ubuntu 14.04 if that makes a difference.

It might also be useful to say that I installed LAMP first like this: sudo apt-get install lamp-server^ and then I installed Zend Server

Any suggestions?

Thank you.


Solution

  • I ended up just changing the php alias to the php that was installed by Zend Server like this:

    alias php=/usr/local/zend/bin/php

    This seems to work, but still looking for a better/proper solution.