could not find driver (SQL: select user_id - php

I am getting this error
could not find driver (SQL: select user_id...
]
I've looked at other related questions and tried the suggestions but I am still getting the same error.
My PHP.ini has extension=php_pdo_mysql.dll
I've added "doctrine/dbal": "^2.5",
I've also tried clearing cache, config, dump auto load etc.
phpinfo() shows there are no PDO drivers.
Previously my phpstorm was pointing at a PHP installation that didn't have extension=php_pdo_mysql.dll enabled but I am still getting the same error even after pointing it to the correct PHP folder.

You need to install PDO drivers first and if it did not solve your problem then below is the issue I have faced before maybe that will help.
sudo apt-get install php5.6-mysql/php7.2-mysql
You also can search for other database systems.
You also can search for the driver:
sudo apt-cache search drivername
Then Run the cmd php artisan migrate
You can also try:
sudo apt-get install php-sqlite3
also check the path for php-cli
If you can, run :
composer update
composer require doctrine/dbal
It looks like you have a missing dependency
Edit:
You might need to comment out the following in your php.ini file.
;extension=pdo_mysql.so
Taken from this post: Laravel 5 PDOException Could Not Find Driver . I think I had to do something exactly like this when setting up laravel on digital ocean.
There must be Query like this one in the code implode inside SQL code. check the variable $mistakeIdArr should not be empty.
$sql = "Select * from `mistake` where `id` in (".implode(',',$mistakeIdArr).")";
I have also checked in my code the PDO is enabled or not
if (extension_loaded('pdo')) { echo "pdo enable";die; }else{ echo "not enable";die;}

Related

PDOException in my Laravel application, despite having pdo_mysql installed

I am trying to run a new Laravel app on my sever but I am getting the following error:
QueryException (SQL) could not find driver (SQL: select * from
settings limit 1)
Using the debugbar I can see the error is for PDO: LOG.error:
PDOException: could not find driver in
/home/mysite.com/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:
What doesn't make sense is that I actually already have PDO installed, I know this because I ran the first php artisan migrate and it created all the tables in my MYSQL DB fine.
I have ran php -m | grep mysql to verify what mysql related PHP extensions I have:
$ php -m | grep mysql
mysqli
mysqlnd
pdo_mysql
I should note that PHP can use MySQL as I have a Wordpress blog running on the same server fine.
I have already tried clearing the cache and updating composer packages, I have also completely removed doctrine/dbal and reinstalled.
Update: If I remove the package doctrine/dbal and clear the caches, I still receive an error about PDOExceptions:
Illuminate\Database\QueryException could not find driver
/home/mysite.com/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php#68
Try this:
composer update
composer require doctrine/dbal
It looks like you have a missing dependency
Notice:
You might need to comment out the following in your php.ini file.
;extension=pdo_mysql.so
stackoverflow.com/a/42561002/2109233 source

TYPO3 can't access to root folder

I am new in TYPO3, I have a running system online and wanted to copy to my localhost, I copied the folder in /var/www/my_production/
I created the database, I can access to the backend without problem but I cant open my site, I get this error :
1323059807: You are not allowed to create directories in the folder "/" (More information)
TYPO3\CMS\Core\Resource\Exception\InsufficientFolderWritePermissionsException
thrown in file
/var/www/my_production/typo3/sysext/core/Classes/Resource/ResourceStorage.php
in line 2021.
Any idea how I can fix that problem?
EDIT ::
After clearing the cache from the Install Tool, I got :
Fatal error: Call to undefined function
TYPO3\CMS\Core\Utility\xml_parser_create() in
/var/www/clevvermail_dev/typo3/sysext/core/Classes/Utility/GeneralUtility.php
on line 2252
One possible cause is that XML is missing.
Try: sudo apt-get install php7.0-xml or sudo apt-get install php5.6-xml
First steps for each new TYPO3 installation: enter Install Tool and reduce all errors possible. (You might stay with some errors, but you need to understand them.)
TYPO3 gives a lot of hints what has to be changed.
typical errors:
missing directories
missing rights in directories
wrong configuration in php.ini
missing php modules
database errors (connection, user, password)
try to solve these errors first.
Since TYPO7 you can check your extensions from the Install Tool.
For earlier versions:
disable all additional extensions (in PackagesState.php) and get the core working, then enable one extension after the other.

I can not make yii migration

I tried to work with yii basic migrations. yii migrate/create is working, yii migrate - not.
I use command php yii migrate. I get the following message:
Exception 'yii\db\Exception' with message 'could not find driver'
in ../basic/vendor/yiisoft/yii2/db/Connection.php:547
I have found advice that I need to add some files from advanced yii to my basic. I do not know what should be done exactly.
You should install extension to your php of DB, which you are using. In case it is already installed, make sure that it is properly turned on in your php-cli settings.
For example, in case you are using Ubuntu and php5-fpm you can run
sudo apt-get install php5-mysql

Unable to instal MySQL on to my Debian 7 with puTTY

I've been searching through the internet trying to find answers to this all morning but everytime I find a solution, it seems to bring up another problem that a previous solution should have fixed. I seem to be going round and round at the moment. And some help would be appreciated.
I am setting up a MySQL Database on my OVH VPS which is running Debian 7 by using puTTY. It's all relatively new to me since I only bought the server yesterday morning but as I've tried to setup MySQL and phpMyAdmin I've ran in to some problems. I've followed several tutorials, and asked a friend who has also setup his own OVH MySQL Database.
These are the two main tutorials I've been following:
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-debian
https://www.linode.com/docs/databases/mysql/how-to-install-mysql-on-debian-7
I seem to be doing fine until I get up to the point when I actually need to install the MySQL
sudo apt-get install mysql-server
When I run this, it asks my password then installs it. However, at the end it print this
The following packages have unmet dependencies:
mysql-server : Depends: mysql-server-5.5 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Firstly to solve this, I tried to install mysql-server-5.5 (since that is what it says it depends on). However, it then says mysql-server-5.5 depends on something else, and that something else depends on something else and so on.
It keeps repeating this until I get to 'libc6', which I then install using the same command
sudo apt-get install libc6
But this time, it prints a long error
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
Setting up phpmyadmin (4:3.4.11.1-2+deb7u1) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing phpmyadmin (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
phpmyadmin
E: Sub-process /usr/bin/dpkg returned an error code (1)
It was talking about locked files so I did another Google search and came to this
https://askubuntu.com/questions/15433/unable-to-lock-the-administration-directory-var-lib-dpkg-is-another-process
However its suggestion was to remove the locked file with the command
sudo rm /var/lib/apt/lists/lock
However, it said it should only be used as a last resort so I decided not to do it. Anyway, the original MySQL setup tutorial I was following didn't mention anything about installing all these dependencies, therefore I went back to the error I got when I first did 'sudo apt-get install mysql-server'
(Here's the original error again)
The following packages have unmet dependencies:
mysql-server : Depends: mysql-server-5.5 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
I pretty much just pasted the whole thing in to Google search and found this result
https://askubuntu.com/questions/489815/cannot-install-mysql-server-5-5-the-following-packages-have-unmet-dependicies
The first answer was talking about removing and changing the version of MySQl (this solution didn't apply to me) so I tried the second solution which was to use the command 'sudo aptitude install mysql-server'. I did this and returned a similar error to before about the locked files
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
Setting up phpmyadmin (4:3.4.11.1-2+deb7u1) ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing phpmyadmin (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
phpmyadmin
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
So now, I've realised I've screwed something up. So how can I unlock this file so I can install the other items? I didn't quite understand and wasn't confident using the post about unlocking locked files so how would I use it in my situation?
I've concluded that I've messed something up whilst setting up phpMyAdmin and MySQL since the error message contains something about that. And my overall question is how can I unlock these files? And then install the MySQL stuff correctly? Because right now, I've not installed something right...
Any suggestions are greatly appreciated! Thankyou so much in advance

Laravel Artisan Migrate Install [mcrypt php extension required]

I am receiving this error whenever I try to install Laravel Artisan Migrations. I'll tell you what I have done...
I have gone into my .bash_profile:
export PATH=/opt/local/bin:/opt/local/sbin:/Applications/MAMP/Library/bin/:/Applications/MAMP/bin/php/php5.5.3/bin:$PATH
and when I check to see which version of PHP I am using, it's the one in my MAMP folder. And it is certainly enabled! But when I type Laravel Artisan: Migrate: Install it prompts me back with MCrypt PHP extension required. Composer is functioning properly. So is Laravel 4. It's this Migrations that is giving me trouble.
Not sure that a user name like LaravelSucks is going to make it easy for you to get help from the Laravel community, but since we're generally bigger than that ... I think you'll find your answer here.
If that doesn't work for you, you may need to set it up manually, e.g.
sudo apt-get install php5-mcrypt

Categories