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