Home > Database > Mysql Tutorial > body text

Why Can\'t PHP Find the MySQL Driver in a LAMP Setup?

Barbara Streisand
Release: 2024-11-01 17:27:30
Original
390 people have browsed it

Why Can't PHP Find the MySQL Driver in a LAMP Setup?

PDOException: Could Not Find Driver in PHP

Problem:

You encounter the "PDOException "could not find driver"" error when attempting to create a schema with Symfony2 on a Linux system running LAMP.

Cause:

The error suggests that PHP cannot locate the necessary MySQL driver. In your case, you have confirmed that the appropriate line for the MySQL driver is uncommented in the php.ini file but still encounter the issue.

Solution:

As indicated in the error message, PHP is unable to load the dynamic library for MySQL (/usr/lib/php5/20090626 lfs/mysql.so). To resolve this, open the terminal and execute the following command:

sudo apt-get install php5-gd php5-mysql
Copy after login

This command will install the required PHP modules, including MySQL, allowing PHP to locate and utilize the necessary driver for MySQL connections.

Once the installation is complete, rerun the Symfony2 command to create the schema. The error should no longer appear.

The above is the detailed content of Why Can\'t PHP Find the MySQL Driver in a LAMP Setup?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!