php artisan migrate [PDOException] could not find driver - php

When I write command "php artisan migrate" from mysql connection,linux terminal gives this error :[PDOException] could not find driver.
When I add to
php.ini
extension=pdo.so
extension=pdo_mysql.so
,
error has changing like this:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/pdo_mysql.so' - /usr/lib/php5/20121212/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: Module 'PDO' already loaded in Unknown on line 0
[PDOException]
could not find driver
How can we solve this issue?
Thanks

Hi you need to install php pdo driver
Open terminal
sudo apt-get install php5-mysql
Restart Apache server
sudo service apache2 restart

Related

Unable to load dynamic library php_ldap.dll on linux

Hi I'm running a Linux server and I keep getting this error thrown as a notice.
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php/20151012/php_ldap.dll' -
/usr/lib/php/20151012/php_ldap.dll: No such file or directory in Unknown on line 0
Is a .dll still needed? I have the .so since it's on linux.
sudo apt-get install php-ldap solved it for me

Laravel - Getting [PDOException] could not find driver

I am using Lampp apache server and when I run the command php artisan migrate am getting this error message:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_pdo_mysql.dll' - /usr/lib/php/20151012/php_pdo_mysql.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[Illuminate\Database\QueryException] could not find driver (SQL: select * from information_schema.tables where table_schema = seo-cms and table_name = migrations)
[PDOException] could not find driver
I enabled the pdo extension from my php.ini from /opt/lamp/etc/php.ini and from /etc/php/7.0/cli/php.ini, I restarted the server, but it is not enough. Most likely I am missing something. Can you help me with this ?
Thx!
[UPDATE]
I executed this: sudo apt-get install php-mysql and it fixed my problem. But I recommend you to give up on lampp and use the apache service2. It is more complicated to install and set configurations on lampp

Problems loading Alternative PHP Cache (APC)

I have a VPS hosted by linode running ubunutu 12.04 LTS. I took a look at my error.log file and it looks like APC isn't loading.
I have
extension=apc.so
in my php.ini file and I've tried:
sudo apt-get purge php-apc
sudo apt-get install php-apc
but that didn't fix it. Here's the error I'm getting.
[28-Mar-2015 10:39:01 America/Los_Angeles] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/apc.so' - /usr/lib/php5/20121212/apc.so: cannot open shared object file: No such file or directory in Unknown on line 0
I found a copy of the apc.so file here:
/usr/lib/php5/20090626/apc.so
I tried changing the php.ini file to:
extension=/usr/lib/php5/20090626/apc.so
and restarted apache
sudo service apache2 restart
but got this error instead
[28-Mar-2015 10:56:43 America/Los_Angeles] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/apc.so' - /usr/lib/php5/20090626/apc.so: undefined symbol: zend_unmangle_property_name in Unknown on line 0

composer cannot find pdo_mysql php extension

When I tried to run PHP composer command : php -c /etc/php5/apache2/php.ini ~/composer.phar
install, the composer returns the following message and I cannot run the laravel framework.
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php5/20121212/pdo_mysql.so' - /usr/lib/php5/20121212/pdo_mysql.so: undefined
symbol: pdo_parse_params in Unknown on line 0
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output: PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php5/20121212/pdo_mysql.so' - /usr/lib/php5/20121212/pdo_mysql.so: undefined symbol: pdo_parse_params in Unknown on line 0
I googled, and I tried run sudo apt-get install php5-mysql, it saids php5-mysql already the
newest. And I tried to run command sudo php5enmod pdo_mysql. But I run the php composer
again, same error happened. It seems php5 cannot find pdo_mysql. I believed it may caused by
PHP installation. I tried to remove the PHP5 mannually. So how can I make PHP find the
pdo_mysql again? Thanks

Warning, when I run a PHP script

When I run a php script in console, I'm getting a following warning:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/php_mcrypt.dll' - /usr/lib/php5/20090626/php_mcrypt.dll: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/php_curl.dll' - /usr/lib/php5/20090626/php_curl.dll: invalid ELF header in Unknown on line 0
The PHP script is correct, because it works on other comuputers.
I have an Ubuntu and server apache2
Check your php.ini currently you are trying to load a windows extension on a linux server.
Have a look in the folder /etc/php5/apache2/ for any file with a name like mcrypt and see if it references a dll file. If so, delete that file and restart apache
If you have ubuntu then sudo apt-get install php5-mcrypt will enable mcrypt for you

Categories