Installing PDO_MYSQL PHP extension on CPanel?

2019-02-19 23:52发布

问题:

I recieved this error while installing Magento on a customer's server, 'PHP Extension "pdo_mysql" must be loaded'. How would one go about installing/enabling this extension through CPanel Accelerated?

Server information is as follows:

  • cPanel Version 11.24.5-STABLE
  • cPanel Build 38506
  • Apache version 2.2.13 (Unix)
  • PHP version 5.2.8
  • MySQL version 5.0.81-community
  • Architecture i686
  • Operating system Linux
  • Kernel version 2.6.18-128.1.6.el5
  • cPanel Pro 1.0 (RC1)

Thanks!

回答1:

You can enable PDO in cPanel if you have cloudlinux installed. In cPanel search for PHP Version and on the resulting screen select and enable PDO and finally select save. * http://docs.cloudlinux.com/index.html?using_php_selector.html

If you do not have CloudLinux and PhpSelector installed you will need an administrator account to install PDO through easyapache. In WHM follow this guide:

Enabling PDO in Easyapache

  1. Log in to WHM ( http://domain.com/whm )
  2. Goto WHM »Software »EasyApache (Apache Update)
  3. Select "Previously Saved Config (** DEFAULT **)" and click "Start customizing based on profile"
  4. On the "Apache Version" page click "Next"
  5. On the "PHP Version" page click "Next"
  6. On the "Short Options List" page click"Exhaustive Options List"
  7. On the "Exhaustive Options List" ensure that PDO, PDO sqlite and PDO MySQL are selected.
  8. Then Click Build on the bottom of the page.

PS. I note that you are on 11.24.5-STABLE. This is a extremely old version of WHM/cPanel. You should update your server as this version of cPAnel is no longer supported by cPanel.



回答2:

I'm using Magento CE 1.7, CentOS 6, and WHM 11.38, and here's what I did to resolve the 'PHP Extension "pdo_mysql" must be loaded' error I received during my Magento install:

  1. Open WHM and go to Home » Software » Easy Apache (Apache Update)
  2. Scroll to the bottom and select "Start customizing based on profile"
  3. Click "Next step" twice
  4. Scroll to the bottom and select "Exhaustive Options List"
  5. Select checkboxes for PDO and PDO MySQL, and rebuild Apache
  6. Go to Magento's root, copy php.ini.sample to php.ini
  7. Open the newly created php.ini file and add the following:

    extension=pdo.so
    extension=pdo_sqlite.so
    extension=sqlite.so
    extension=pdo_mysql.so

This might be a good time to restart Apache using terminal (# service httpd restart). Hope that helps!



回答3:

I don't think you can do it in a shared host or with cPanel.

Convince the webhost to install it for you.