Install php5 and pdo_mysql on 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 the installation procedure record. First, I directly installed apache2, php5, pear and mysql5 with apt-get. In order to facilitate subsequent installation, also added the make and libmysqlclientsudoapt-getinstallapache2-mpm-preforksu these days to try to migrate the work machine to Ubuntu to do development, the first task after the system installation is to install php + mysql development environment. I plan to install php5 and pdo_mysql directly. The following is the installation procedure record.

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

Sudoapt-getinstallapache2-mpm-prefork

Sudoapt-getinstallphp5

Sudoapt-getinstallphp5-dev

Sudoapt-getinstallphp5-pear

Sudoapt-getinstallmysql-server-5.0

Sudoapt-getinstallmake

Sudoapt-getinstalllibmysqlclient15-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:

Peclinstallpdo

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 ran peclinstallpecl_mysql directly. I searched for the problem and found it was a problem with pecl. Below is a simple solution:

Wget

TarxzvfPDO_MYSQL-1.0.2.tgz

CdPDO_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

Makeinstall

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.
Related Article

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.