MySql driver not installed error for Zend application - php

I am trying to get my ZEND application up on my apache server running on UNIX. Initially my host didnot give PDO support ,and i got it enabled by requesting them with a mail.But now I am getting an error saying The mysql driver is not currently installed
The stack trace is like:
An error occurred
Application error
Exception information:
Message: The mysql driver is not currently installed
Stack trace:
#0 /home/windchim/worminc/library/Zend/Db/Adapter/Abstract.php(770): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /home/windchim/worminc/library/Zend/Db/Adapter/Abstract.php(840): Zend_Db_Adapter_Abstract->quote('aaditya258', NULL)
#2 /home/windchim/worminc/library/Zend/Auth/Adapter/DbTable.php(354): Zend_Db_Adapter_Abstract->quoteInto('`password` = MD...', 'aaditya258')
#3 /home/windchim/worminc/library/Zend/Auth/Adapter/DbTable.php(285): Zend_Auth_Adapter_DbTable->_authenticateCreateSelect()
#4 /home/windchim/worminc/library/Zend/Auth.php(117): Zend_Auth_Adapter_DbTable->authenticate()
#5 /home/windchim/worminc/application/controllers/LoginController.php(117): Zend_Auth->authenticate(Object(Zend_Auth_Adapter_DbTable))
#6 /home/windchim/worminc/library/Zend/Controller/Action.php(503): LoginController->processAction()
#7 /home/windchim/worminc/library/Zend/Controller/Dispatcher/Standard.php(285): Zend_Controller_Action->dispatch('processAction')
#8 /home/windchim/worminc/library/Zend/Controller/Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#9 /home/windchim/public_html/worm/index.php(47): Zend_Controller_Front->dispatch()
#10 {main}
How can this be resolved? Please help

PDO, unlike the mysql_* functions, supports a number of database engines.
To do this it needs a driver library for each one.
You have the "core" of PDO installed but not the MySQL driver - just get that installed (called pdo_mysql) and everything will be OK.
Your php.ini should have one of these (windows or linux):
extension=php_pdo_mysql.dll
extension=php_pdo_mysql.so

In php.ini file u just enable following line
extension=php_pdo_mysql.dll (means remove comments in front of it)
then it will be executed Correctly.

As others have mentionned, you need to enable the pdo_mysql extension.
However, running php (5.3) as an apache (2.2) module on my machine (windows 7), it still wouldn't work. I figured out the extension_dir value in php.ini needs to be set using an absolute path (relative just wouldn't work)!
Hope this helps some of you!

mysql extension was deprecated and is totally removed in php7
You should check php-mysql package. If not yet install, let run sudo apt-get install php-mysql

F.i. check spelling of
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
(should be like this at production stage)
If you type
error_reporting (value);
or something like this (usually for testing, "value" might be "0")
you may get this mistake
"The mysql driver is not currently installed"
if you use
So any Syntax Error within the php.ini might generate this mistake.
If you setup your system carefully always you might get confused easily, because you know, there are no mistakes at db installation or settings.
If everthing else is correct, so go for a syntax error in php.ini.

Related

Wordpress executing ThreadSafe PHP with apache can not connect to mysql but IIS and NTS PHP has no problem

I developed a WordPress site for running on IIS with PHP FastCGI, that works.
I found that website is so slow, so tried to test it under Apache.
Now I have an installed WordPress site, IIS, Apache and 2 different php installation.
1 PHP is Non-Thread-Safe PHP (V7.4.9) that will be called by IIS FastCGI module and works correctly.
Another is ThreadSafe PHP (V7.4.9) that will be called from Apache and works but not for mysql.
When I execute code under Apache (localhost:81) it produces below error:
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in D:\Website\wp-includes\wp-db.php:1670
Stack trace:
#0 D:\Website\wp-includes\wp-db.php(632): wpdb->db_connect()
#1 D:\Website\wp-includes\load.php(476): wpdb->__construct('DB_USER_VAL', 'DB_PASS_VAL', 'DB_NAME_VAL', '127.0.0.1')
#2 D:\Websites\Navand\wp-settings.php(124): require_wp_db()
#3 D:\Website\wp-config.php(92): require_once('D:\\Website...')
#4 D:\Website\wp-load.php(37): require_once('D:\\Website...')
#5 D:\Website\wp-blog-header.php(13): require_once('D:\\Website...')
#6 D:\Website\index.php(17): require('D:\\Website...')
#7 {main} thrown in D:\Website\wp-includes\wp-db.php on line 1670
Note:
Apache PHP works correctly when calling phpinfo()
extension_dir has been set for both php installations
both php_mysql and pdo_mysql are enabled for both php installation
both php.ini files are same (checked by WinMerge)
Why calling same mysql functions on Apache and TS-PHP generates error, but works correctly on IIS? and how can I resolve this problem (as I can not change WordPress source)
Surprise!
According to answer https://stackoverflow.com/a/14786808/1441476, using absolute extension dir in php.ini for version that runs under apache, worked for me (extension_dir = "C:/Programs/php/php-7.4.9-Win32-vc15-x64/ext" instead of extension_dir = "ext")

gRPC and XAMPP not working

For a project I want to test the new database from Firebase, Firestore with PHP. But before i can use it, I need a couple of tools. I am trying for a day now to get it work, but no success.
I'm stuck on gRPC. I installed is, and it's working on my Mac and I can install Firestore with Composer, but I can't get it to work with XAMPP.
When I load a page I get
Fatal error: Uncaught Google\Cloud\Core\Exception\GoogleException: The requested client requires the gRPC extension.
Please see https://cloud.google.com/php/grpc for installation instructions. in /vendor/google/cloud-core/src/ClientTrait.php:75 Stack trace: #0 /vendor/google/cloud-firestore/src/FirestoreClient.php(115): Google\Cloud\Firestore\FirestoreClient->requireGrpc() #1 /app/firebase.php(18): Google\Cloud\Firestore\FirestoreClient->__construct() #2 /app/firebase.php(21): App\initialize() #3 /template.php(688): require_once('/Applications/X...') #4 /template.php(647): load_template('/Applications/X...', true) #5 /App in /vendor/google/cloud-core/src/ClientTrait.php on line 75
I added extension=grpc.so to the php.ini that is loaded by XAMPP.
But no success.
Try to use DLL file, download from here https://pecl.php.net/package/gRPC
Open your php.ini file and uncomment the line extension_dir="ext",
add extension="grpc".
Then go to the environment variables in the properties, choose path in the system variables and add the php path you are using.
I am using C:\xampp\php that's where all the magic will happen it's been a tag of war.

PHP: mysqli extension doesn't load

I try to use MySQL with PHP and I have this error:
Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in 'file_name Stack trace: #0 {main} thrown in 'file_name'`
When doing print_r( get_defined_functions()), I see that the MySQLi extension isn't there, but it is "loaded" in the php.ini file (I mean this is not in a commentary).
I specify that the PHP directory is in the PATH (I'm under windows) and MySQL, PHP and Apache are on my C: disk.
I don't know where is the problem, this is probably a small thing but I can't see which one so.
My versions are:
Apache 2.4.47
PHP 7.1.7
MySQL 5.7
Windows 7
PS : php_mysqli.dll do only 97k. I don't know if it's normal.
HOW I SOLVED THIS : I have just added extension_dir="path_to_php\ext" under the lines who load extentions, in the php.ini file. This line is used to indicate where are the extentions in your hard disk. Don't forget to restart your server, it will reload the php.ini file.
First of all, run phpinfo() to make sure you are looking at the correct php.ini.
If your php.ini file has extension=php_mysqli.dll uncommented check your extension directory. You may need to set it explicitly, like:
extension_dir="C:\xampp\php\ext"
If the problem persists check the apache error log, you should find more info there.

Magento 2.0.2 installation on shared server - Stuck at 66%

I've been having a nightmare with Magento 2 installation on shared server. The thing is that I don't have problems with shared server. I can get as much resources and config as Magento needs.
But it gets stuck on 66% and this is Console log:
Module 'Magento_Directory':
Installing data..
[ERROR] exception 'Exception' with message 'Warning: Error while sending QUERY packet. PID=47710 in
/home/gottstor/public_html/store/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php on line 228' in /home/gottstor/public_html/store/vendor/magento/framework/App/ErrorHandler.php:61
Stack trace:
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'Error while sen...', '/home/gottstor/...', 228, Array)
#1 /home/gottstor/public_html/store/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#2 /home/gottstor/public_html/store/vendor/magento/framework/DB/Statement/Pdo/Mysql.php(95): Zend_Db_Statement_Pdo->_execute(Array)
#3 /home/gottstor/public_html/store/vendor/magento/zendframework1/library/Zend/Db/Statement.php(303): Magento\Framework\DB\Statement\Pdo\Mysql->_execute(Array)
#4 /home/gottstor/public_html/store/vendor/magento/zendframework1/library/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
I did install it on localhost with no issues. But can't get it work on Shared Hosting.
Max execution time is set to 60, max allowed packet in MySQL set to 268M, max_input_vars 5000, memory_limit 512M.
I have searched the web, posted on Magento forums, with no luck.
Any ideas?
In my case, it is about timeout issue.
remove var/.maintenance.flag
remove app/etc/config.php & env.php
cleanup you DB.
in php.ini, set max_execution_time=500
run yourmagento.com again
Done.
make sure your php memory_limit should be sufficient, like 2028M.
this helps in my case .
Go to your php.ini file in your PHP root. (mine is c:\php\php.ini)
Find max_execution_time and set to 200 or 300. (mine original was 60)
Go to your created database, remove all the tables.
Restart your server. (mine is apache)
Repeat your installation steps.
Good luck.
I faced with the same problem. Magento installation stoped on Installing data..
Run this script sudo php bin/magento setup:static-content:deploy
It helped me and magento site srtarted to work. (I just closed installation page)
max_execution_time 500
Try to increase your ram as well if you are using virtual machine
Restart the installation.
Regards,

vagrant-shopware fails at establishing database connection

This error is shown after step 4 of installation "Database import" . I cannot understand why referenced file "sw4_clean.sql" is not in github repo of Shopware-4 at location shown it should show as missing during install?
I tried editing config.php before each attempt to establish database. This was my results
with database details = Internal Sever Error
as shown in config.php.dist = Internal Sever Error
empty = config.php now populate with settings = Internal Sever Error
I am using Vagrant build on windows 8 https://github.com/eriksixt/vagrant-shopware
Can anyone shed some light on to what might be going wrong?
Error
Received an error message.
URL: importDatabase?offset=0&totalCount=0
Message: Internal Server Error
Please try to fix this error and restart the update.
Response
{"code":2,"message":"fopen(\/vagrant\/shopware-
4\/install\/src\/..\/assets\/sql\/sw4_clean.sql)
: failed to open stream: No such file or directory",
"file":"\/vagrant\/shopware-
\/install\/src\/lib\/Shopware_Components_Dump.php",
"line":36,"trace":"#0 [internal function]: Slim\\Slim::handleErrors(2,
'fopen(\/vagrant\/...', '\/vagrant\/shopwa...', 36, Array)
\n#1 \/vagrant\/shopware-4\/install\/src\/lib\/Shopware_Components_Dump.php(36):
fopen('\/vagrant\/shopwa...', 'rb')\n#2 \/vagrant\/shopware-
4\/install\/src\/app.php(318): Shopware_Components_Dump-
>__construct('\/vagrant\/shopwa...')\n#3 [internal function]:
{closure}()\n#4 \/vagrant\/shopware-4\/engine\/Library\/Slim\/
Router.php(172): call_user_func_array(Object(Closure), Array)\n#5
\/vagrant\/shopware-4\/engine\/Library\/Slim\/Slim.php(1225): Slim\\Router-
>dispatch(Object(Slim\\Route))\n#6 \/vagrant\/shopware-
4\/engine\/Library\/Slim\/Middleware\/Flash.php(86): Slim\\Slim->call()\n#7
\/vagrant\/shopware-4\/engine\/Library\/Slim\/Middleware\/MethodOverride.php(94):
Slim\\Middleware\\Flash->call()\n#8 \/vagrant\/shopware-
4\/engine\/Library\/Slim\/Middleware\/PrettyExceptions.php(67):
Slim\\Middleware\\MethodOverride->call()\n#9 \/vagrant\/shopware-
4\/engine\/Library\/Slim\/Slim.php(1176): Slim\\Middleware\\PrettyExceptions-
>call()\n#10 \/vagrant\/shopware-4\/install\/index.php(59): Slim\\Slim->run()\n#11 {main}"}
Did you check the strict mode issue? Shopware does not like strict mode, which is enabled by default in the current mysql version. In my case the following configuration (my.cnf or my.ini dependent on the OS) did help:
[mysqld]
sql_mode="TRADITIONAL,NO_AUTO_CREATE_USER"
It seems like your are trying to use the installer on a git checkout of Shopware. That is not possible. Some files needed for the installer, for example "sw4_clean.sql" are generated in a deploy step when the install package is built.
To install Shopware using a git checkout please see: https://github.com/shopware/shopware#installation-via-git

Categories