Reputation: 1263
After one hour tring to solve this problem I failed ): my error message is :
Generating autoload files
PHP Fatal error: Class 'PDO' not found in /usr/share/nginx/html/laravel/app/config/database.php on line 16
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'PDO' not found","file":"\/usr\/share\/nginx\/html\/laravel\/app\/config\/database.php","line":16}}Script php artisan clear-compiled handling the post-update-cmd event returned with an error
[RuntimeException]
Error Output: PHP Fatal error: Class 'PDO' not found in /usr/share/nginx/html/laravel/app/config/database.php on li
ne 16
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [packagesN]
I am using linux centos 6.4 php 5.5.3 and laravel 4.
Could you help me thanks very much.
Upvotes: 1
Views: 18346
Reputation: 150
Here's my answer for Laravel 5 on CentOS 7 using NGINX+PHP-FPM.
CentOS 7 only PHP 5.4 is supported (at time of writing). You can install PHP versions 5.5 or 5.6 (and perhaps others) using the WebTatic repo. In the end, I decided to launch a clean CentOS 7 instance, here's my recipe:
Minimal ISO install of CentOS 7 + yum install epel-release (if not using the Minimal install, try to yum remove php and other php-* packages).
Install the WebTatic repo: sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Install minimum set of PHP 5.6 packages for Laravel 5: sudo yum install php56w php56w-opcache php56w-common php56w-pdo php56w-mbstring
For NGINX PHP support, I use PHP-FPM: sudo yum install php56w-fpm
For any other PHP packages that are required, assuming the WebTatic repo is installed, substitute php- with php56w- in the package name.
Upvotes: 0
Reputation: 346
You can check if PDO is supported and which drivers are available using this script:
<?php
if (defined('PDO::ATTR_DRIVER_NAME')) {
print_r(PDO::getAvailableDrivers());
} else {
echo 'PDO unavailable';
}
If it says "PDO unavailable" you have to install and enable it.
For installing PDO on centos type:
yum install php-pdo
Upvotes: 3
Reputation: 15389
You'll need to:
extension=pdo.so
extension=pdo_mysql.so
to your php.ini
file.
Upvotes: 9