Zend Server 8 PDO could not find driver via CLI - php

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.

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.

Related

LDAP not loading into php 5.6 on RHL 7

I'm having some issues connecting to an LDAP server using PHP 5.6 on a RHL 7 environment. The application itself is running Codeigniter, and when I attempt an LDAP connection I get the error:
LDAP functionality not present. Either load the module ldap php module
or use a php with ldap support compiled in.
I've used yum to install PHP-ldap and openldap, as well as manually added the extension in the loaded PHP.ini file with.
extension=/usr/lib64/php/modules/ldap.so
However, I'm still getting the error, and phpinfo () is not showing ldap as a loaded module.
I've also checked my Apache error logs for anything useful in there. While I'm getting no errors when I attempt to reload the page, when I restart the server, I am getting an error:
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib64/php/modules/ldap.so' - /usr/lib64/php/modules/ldap.so:
cannot open shared object file: No such file or directory in Unknown
on line 0
I have checked, and ldap.so does exist at that location.
I should also mention that PHP is installed at an abnormal location, it's at /opt/rh/rh-php56, not sure if that might be causing the issue.
UPDATE: -----------
I've copied and moved ldap.so to /opt/rh/rh-php56/root/usr/lib64/php/modules/ldap.so and removed the path in php.ini so that it now calls ldap like extension=ldap.so.
The warning has changed to
PHP Warning: PHP Startup: ldap: Unable to initialize module\nModule
compiled with module API=20100525\nPHP compiled with module
API=20131226\nThese options need to match\n in Unknown on line 0
Is there something I need to do to compile the ldap.so file?
The issue came down to installing the wrong version of LDAP for the version of PHP the server was running.
As I am running rh-php56-php, I also needed to install rh-php56-php-ldap, not the standard php-ldap package. Once the correct package was installed, the errors that I was encountering ceased.

Cassandra PHP libcassandra.so.2: cannot open shared object file

So I have spent the best part of the day trying (and failing) to get the php driver for apache cassandra to install on my server (CentOS 7).
After a lot of mucking about and a few grey hairs i have finally got the driver to install but unfortunately it doesnt actually load.
In my apache Error log i get
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/cassandra.so' - libcassandra.so.2: cannot open shared object file: No such file or directory in Unknown on line 0
I have checked and the libcassandra.so.2 file does indeed exist in /usr/local/lib64/libcassandra.
Has anyone come across a similar ptoblem?
Any help would be appreciated.
Im Running CentOS 7 and PHP 5.4.16 and Apache 2.4.6
Thanks
Matt.
the problem i was having was that libcassandra was installed into /usr/local/lib64 not /usr/lib64
a simple ln -s /usr/local/lib64/libcassandra.so.2 /usr/lib64/libcassandra.so.2 command fixed the problem

Xampp - MS SQL - PHP 5.5

I'm trying to get the PDO SQL driver to work with my Xampp and PHP 5.5 installation. I have followed the directions found below as Microsoft has yet to make a PHP 5.5 SQL driver:
As you can see by the images I have downloaded the file, placed it into my C:\xampp\php\ext folder and added it to php.ini and restarted apache.
But still when running phpinfo(); it shows it as not loaded. What did I do wrong?
EDIT:
Error log for PHP shows this:
[25-Sep-2014 14:22:11 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_sqlsrv_55_ts.dll' - The specified module could not be found.
in Unknown on line 0
[25-Sep-2014 14:22:11 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_pdo_sqlsrv_55_ts.dll' - The specified module could not be found.
in Unknown on line 0
It seems by using Dependency Walker (http://www.dependencywalker.com) I found out that the modules couldn't find php5ts.dll file, even though it was directory up.
So I edited the Windows 2008 R2 Environment Variables and added C:\xampp\php to the Path variable and it worked like a charm.
I used the instructions here on how to edit the variables in Windows:
http://thommck.wordpress.com/2010/12/06/how-to-add-a-path-to-the-system-variables-in-windows-2008-r2/

PHP 5.5 not finding MySQLi constructor

I have mySQL and PHP 5.5 installed on an AWS EC2 instance. However, when I try
$db = new mysqli($args)
PHP kicks me to the autoloader, as if it can not find the constructor for the mysqli object. I have uncommented extension=mysql.so in the php.ini file, but that does not seem to have accomplished anything. At startup, I get
PHP Startup: Unable to load dynamic library '/usr/lib64/php/5.5/modules/msql.so' - /usr/lib64/php/5.5/modules/msql.so: cannot open shared object file: No such file or directory in Unknown on line 0
I thought that mysqli/native driver came prepackaged with PHP5.5, but maybe I was wrong about that. Can someone give me a hint as to how PHP5.5 plays with mysqli?
It doesn't come prepackaged in the case of Amazon Linux. It's an addon module (Assuming you are using Amazon Linux). You can run:
sudo yum install php55-mysqlnd
Maybe misspelled? PHP is trying to load msqli.so, not mysqli.so. Check that you write "extension=mysqli.so", not "extension=msqli.so"

Trying to setup a PHP daemon using System_Daemon and I'm having issues getting it to run

I get the following error when trying to start a daemon using Ubuntu 10.04 and the PHP5:
PHP Warning: PHP Startup: Unable to load dynamic library 'usr/lib/php5/20060613/pcntl.so' - /usr/lib/php5/20060613/pcntl.so: cannot open shared object file: No such file or directory in Unknown on line 0
Does System_Daemon try to call pcntl? If so, why is it looking for the file where it does not exist?
Yes, System_Daemon uses the pcntl_fork function to spawn its child processes. I'd guess you don't have pcntl installed. If you do, you could create a symlink to the pcntl.so file at that path so PHP can find it.

Categories