installation - PHP Extensions "pdo_mysql" must be loaded - magento

This is whay i see on phpinfo();
pdo_mysql
PDO Driver for MySQL enabled
Client API version 5.1.68
Directive Local Value Master Value
pdo_mysql.default_socket /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock
but im still getting the magento message :
"PHP Extensions "pdo_mysql" must be loaded"
why is that ?

open or make php.ini file into root directory and add the following code:
extension=pdo.so
extension=pdo_sqlite.so
extension=sqlite.so
extension=pdo_mysql.so

Related

Getting a 'Please make sure the PHP Redis extension is installed and enabled.' error despite the extension being loaded

I'm getting spammed with Please make sure the PHP Redis extension is installed and enabled. in my logs, despite having the redis.so extension installed on MacOS. I installed the Redis extension by running pecl install redis, which succeeds with the following message:
Installing '/usr/local/Cellar/php/7.3.12/pecl/20180731/redis.so'
install ok: channel://pecl.php.net/redis-5.1.1
Extension redis enabled in php.ini
By running phpinfo() in tinker, I can see that my loaded php.ini is
Configuration File (php.ini) Path => /usr/local/etc/php/7.3
Loaded Configuration File => /usr/local/etc/php/7.3/php.ini
If I open up /usr/local/etc/php/7.3/php.ini, extension="redis.so" is listed at the top of the file.
What makes this more and more strange is that if I dig deeper into where the original Please make sure the PHP Redis extension is installed and enabled. error is coming from, it looks to be in laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:76, which looks like this:
throw new LogicException(extension_loaded('redis') ? 'Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.' : 'Please make sure the PHP Redis extension is installed and enabled.');
So according to this, the extension isn't loaded. But if I load up tinker again and run extension_loaded('redis') then I get a true result.
I can't for the life of me figure out what's going on here. Why does PhpRedisConnector not see that the extension is loaded?
For completeness, I've also removed the Redis alias from my app.php file as instructed to by the Laravel docs.
For those who installed Redis with composer require predis/predis, as described in the Laravel official documentation.
In config/database.php, change:
'redis' => [
//'client' => env('REDIS_CLIENT', 'phpredis'),
'client' => env('REDIS_CLIENT', 'predis'),
The accepted answer is just a workaround to use predis instead of PHPRedis. If you still want to use PHPRedis and still facing the same issue as the main question then maybe you are running into the same issue as me. In my case the Please make sure the PHP Redis extension is installed and enabled error only throw out if running the Job by crontab. Turn out that somehow the version of PHP which using in the crontab is not the same as the PHP version that I installed the PHP Redis to. So here is what I did:
Find out where is the current PHP path:
MacBook-Pro:hpt hantran$ which php
/usr/local/bin/php
Change the crontab from
* * * * * cd /Applications/XAMPP/xamppfiles/htdocs/hpt && php artisan schedule:run >> /dev/null 2>&1
To:
* * * * * cd /Applications/XAMPP/xamppfiles/htdocs/hpt && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1
The original answer can be found here https://laracasts.com/discuss/channels/general-discussion/please-make-sure-the-php-redis-extension-is-installed-and-enabled?page=1#reply=659249
Add this to your env file
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
REDIS_CLIENT=predis <---Add this line-->

Laravel migration cannot find driver when using sqlsrv database in windows

I am using sqlsrv database connection in my project as I need to connect to Microsoft SQL Database.
I have successfully installed the sqlsrv driver because I can connect to the Database to retrieve data.
But when I try to do the Laravel Migration, it shows an error:
Illuminate\Database\QueryException : could not find driver (SQL: select * from sysobjects where type = 'U' and name = migrations)
Below is my .env
DB_CONNECTION=sqlsrv
DB_HOST=**********.database.windows.net
DB_PORT=1433
DB_DATABASE=****************_4cd1_9d18_2a7d9ddbcd13
DB_USERNAME=***************_4cd1_9d18_2a7d9ddbcd13_ExternalWriter
DB_PASSWORD=***************
php.ini
extension=php_xmlrpc.dll
extension=php_xsl.dll
extension=php_pdo_sqlsrv_7_nts_x64.dll
extension=php_pdo_sqlsrv_7_nts_x86.dll
extension=php_pdo_sqlsrv_7_ts_x64.dll
extension=php_pdo_sqlsrv_7_ts_x86.dll
extension=php_pdo_sqlsrv_71_nts_x64.dll
extension=php_pdo_sqlsrv_71_nts_x86.dll
extension=php_pdo_sqlsrv_71_ts_x64.dll
extension=php_pdo_sqlsrv_71_ts_x86.dll
extension=php_sqlsrv_7_nts_x64.dll
extension=php_sqlsrv_7_nts_x86.dll
extension=php_sqlsrv_7_ts_x64.dll
extension=php_sqlsrv_7_ts_x86.dll
extension=php_sqlsrv_71_nts_x64.dll
extension=php_sqlsrv_71_nts_x86.dll
extension=php_sqlsrv_71_ts_x64.dll
extension=php_sqlsrv_71_ts_x86.dll
How to use SQL Server DLL files with PHP 7.2 version on xampp
https://github.com/Microsoft/msphpsql/releases
To download Windows DLLs for PHP 7.1 or above from the PECL repository, please go to the SQLSRV or PDO_SQLSRV PECL page.
https://pecl.php.net/package/sqlsrv/5.6.1/windows
https://pecl.php.net/package/pdo_sqlsrv/5.6.1/windows
NOTE: Do not forget to remove 'php_' prefix when you add extension dll filename in php.ini file. eg.
extension=pdo_sqlsrv
extension=sqlsrv
Do not change actual filename which you put in /xampp/php/ext/ directory.
"7.2 Thread Safe (TS) x86" worked for me for 'sqlsrv' and 'pdo_sqlsrv' extensions.
Restart xampp or apache then you can see enabled 'pdo_sqlsrv' extension when you print phpinfo() in a test php file
It was very hard to find this solution. I hope, this will also help you. All the best :)
You may need to upgrade your PHP version to PHP 7.1.
Now make sure that the files config/database.php and .env are configured properly.
See this one: https://laracasts.com/discuss/channels/general-discussion/connect-laravel-to-microsoft-sql
After fighting with it for a while found a solution :
you need to downloaded it from here then extract the files in your php folder
For PHP 7.4 on Windows 10 (x64), I've solved same error s below:
Downloaded the driver from
https://www.microsoft.com/en-us/download/details.aspx?id=20098
Extracted the archive and copied the file
php_pdo_sqlsrv_74_ts_x64.dll to the ext folder (C:\Program Files\php74\ext in my setup)
Added extension=php_pdo_sqlsrv_74_ts_x64.dll into php.ini file
In my .env file I've DB_CONNECTION=sqlsrv so I first thought php_sqlsrv_74_ts_x64.dll should be used but it didn't work.

Class 'Memcached' not found not.not working in laravel

I have PHP 5.4 on a litespeed web server. PHP has been compiled properly with memcached module and we also installed properly memcached library.
In fact the problem suddenly happened without any change at all (server side) when I run the artisan command, I am getting this error:
PHP Fatal error: Class 'Memcached' not found in /laravel/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php on line 52
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Memcached' not found
I googled the issue but was unable to find a solution. I am using Laravel 5.0.
I edited the app/Http/Routes.php and returned new Memcached and the php object was returned properly...
Any help would be appreciated.
I had the same issue.
Replace in .env file:
From : CACHE_DRIVER=memcached<br/>
To : CACHE_DRIVER=file**
then clear cache : php artisan cache:clear

Composer Update Failed cannot open shared object file:

I just run
composer update
but I got this
Failed loading ./opcache.so: ./opcache.so: cannot open shared object file: No such file or directory
PHP Warning: PHP Startup: Unable to load dynamic library './pdo.so' - ./pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library './calendar.so' - ./calendar.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library './ctype.so' - ./ctype.so: cannot open shared object file: No such file or directory in Unknown on line 0
... so on
I run php -i and got this
Loaded Configuration File => /etc/php/7.0/cli/php.ini
Scan this dir for additional .ini files => /etc/php/7.0/cli/conf.d
Additional .ini files parsed => /etc/php/7.0/cli/conf.d/10-opcache.ini,
/etc/php/7.0/cli/conf.d/10-pdo.ini,
/etc/php/7.0/cli/conf.d/20-calendar.ini,
/etc/php/7.0/cli/conf.d/20-ctype.ini,
... so on
How do I fix it?
Thanks in Advance.
Your php can not find the dlls. To solve it:
Run php -i and find your php.ini location under Loaded Configuration File key.
Search for the dll files php unable to load and find their full path
Update the extension key in your php.ini to the full dll path
for example:
extension=<path>/php_pdo_firebird.dll
extension=<path>/php_pdo_mysql.dll'
extension=<path>/php_pdo_pgsql.dll:
composer use php.ini in /etc/php/7.0/cli/php.ini looks like you uncoment extension_dir
just comment, and reload apache and you done it.

On windows system,I get this error-The mbstring extension is missing. Please check your PHP configurationn

I get this error when I go to localhost/phpmyadmin (I am using WAMP).
I have windows...so the sudo -apt commands solution won't work.Also the line-
extension=php_mbstring.dll is commented out.Any other reason for this?
Okay..so backstage I had this warning on my localhost at the bottom:
* ERROR * The PHP configuration loaded file is: c:/wamp/bin/apache /apache2.4.17/php.ini - should be: C:/wamp/bin/apache/apache2.4.17 /bin/php.ini or c:/wamp/bin/php/php5.6.15/phpforapache.ini
I did this-
1.open cmd.Change the dir to bin of your apache dir.
cd C:\wamp\bin\apache\apache2.4.17\bin
type
mklink php.ini C:\wamp\bin\php\php5.6.15\phpForApache.ini
the cmd read...
symbolic link created for php.ini <<===>> C:\wamp\bin\php\php5.6.15 \phpForApache.ini
exit the cmd and restart your wamp.

Resources