I have just moved to a VPS hosting from a shared hosting, so setting things up. I have installed the PDO and pdo_mysql modules. It is showed they are installed. I have restarted the apache server too.
root@li339-83:~# php -m | grep -i pdo
PDO
pdo_mysql
The following is from phpinfo.
Addition开发者_运维百科al .ini files parsed /etc/php5/apache2/conf.d/mysql.ini, /etc/php5/apache2/conf.d/mysqli.ini, /etc/php5/apache2/conf.d/pdo.ini, /etc/php5/apache2/conf.d/pdo_mysql.ini, /etc/php5/apache2/conf.d/suhosin.ini
The extensions(shown below) are added automatically after installation
extension=pdo_mysql.so; //this is in pdo_mysql.ini
extension=pdo.so; //this is in pdo.ini
But, I am not able to load my webpages. The following is the error
Fatal error: Class 'PDO' not found in /var/www/boot.php on line 39
In the PHP.ini file, we should modify the extension_dir directive option. This should point to the directory which contains the pdo.so and pdo_mysql.so files.
extension_dir = "/usr/lib/php5"
To find the directory where these files are present, use the following unix command,
find / -name pdo.so
Restart apache and the problem is fixed.
精彩评论