简体   繁体   中英

Zend Framework 2 Class 'PDO' not found

Hi i am working with Zend Framework 2, i have a problem when trying to deploy my application to my hosting.

The application works perfectly in localhost (running lampp). However, when i deploy it to my production server (hosting) i get the following error:

Fatal error: Class 'PDO' not found in /xxxx/xxxx/public_html/sandbox/xxxx/config/autoload/global.php on line 20

My production server is running on:

PHP 5.4.22

And here is a screenshot of my phpinfo

phpinfo()的屏幕截图

I am not sure if the following is the one that's causing the problem, but according to the configure command (see phpinfo) there is a parameter that says: "--disable-pdo"

If this turns out to be the problem, how do i fix it?

Thank you for helping...

EDIT 1

So i opened my php.ini file in /usr/local/lib/php.ini (based on the phpinfo loaded configuration file).

After a quick lookup, i did not found anyline that says pdo_mysql.so nor any other lines that contains "pdo". Should i add it myself or is there any other better solution to this..?

So i ended up by recompile apache and php with the following command

'./configure' '--disable-fileinfo' '--enable-bcmath' '--enable-calendar' '--enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--enable-libxml' '--enable-mbstring' '--enable-pdo=shared' '--enable-soap' '--enable-sockets' '--enable-zip' '--prefix=/usr/local' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-bz2' '--with-curl=/opt/curlssl/' '--with-curlwrappers' '--with-freetype-dir=/usr' '--with-gd' '--with-gettext' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libexpat-dir=/usr' '--with-libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pic' '--with-png-dir=/usr' '--with-tidy=/opt/tidy/' '--with-xmlrpc' '--with-xpm-dir=/usr' '--with-xsl=/opt/xslt/' '--with-zlib' '--with-zlib-dir=/usr'

My application is now working as intended.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM