Install php5 + pdo in ubuntu

Source: Internet
Author: User

In the past few days, I have tried to migrate the working machine to ubuntu for development. The first task after the system is installed is to install the development environment of php + mysql. I plan to install php5 and pdo_mysql directly. The following is a record of the installation process.

First, I directly installed apache2, php5, pear, and mysql5 with apt-get. To facilitate subsequent installation, I also added make and libmysqlclient

Sudo apt-get install apache2-mpm-prefork

Sudo apt-get install php5

Sudo apt-get install php5-dev

Sudo apt-get install php5-pear

Sudo apt-get install mysql-server-5.0

Sudo apt-get install make

Sudo apt-get install libmysqlclient15-dev

Pdo does not seem to be able to find the installation source in apt of ubuntu, so it is very simple to install this extension through pecl-if the submarine optical fiber can be connected:

Pecl install pdo

Add a row:

Extension = pdo. so

To file:

/Etc/php/apache2/php. ini

/Etc/php/cli/php. ini

Next, I encountered some problems when installing pdo_mysql. Some errors may occur when I directly run pecl install pecl_mysql. I searched for the problem and found it was a problem with pecl. Below is a simple solution:

Wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz

Tar xzvf PDO_MYSQL-1.0.2.tgz

Cd PDO_MYSQL-1.0.2

Comment out the code snippet in configure to determine whether the pdo extension has been installed and continue running:

Phpize

./Configure

Make

Make install

Then add the following line to the two php. ini mentioned above.

Extension = pdo_mysql.so

After apache is restarted, php5 + pdo_mysql is installed on ubuntu, and documentroot is/var/www.

Postscript

The simpler solution is to run:

PHP_PDO_SHARED = 1 pecl install pdo_mysql


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.