In the past few days, I have tried to move my work machine to ubuntu for development. After the system is installed, the first task is to install the php+mysql development environment. 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 using apt-get. In order 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
It seems that pdo can’t find the installation source in ubuntu’s apt , so it is very simple to install this extension through pecl - if the submarine optical fiber can be connected:
pecl install pdo
Add a line:
extension=pdo.so
To the file:
/etc/php/apache2/php.ini
/etc/php/cli/php.ini
Next install pdo_mysql When encountering some problems, some errors will appear when running pecl install pecl_mysql directly. After searching, I found that it is a problem with pecl itself. Here is a relatively 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 configure to determine whether it is installed For the code snippet of pdo extension, continue to run:
phpize
./configure
make
make install
and then add the following again Go to the two php.ini mentioned earlier in one line
extension=pdo_mysql.so
After restarting apache, php5 + pdo_mysql is installed on ubuntu, and the documentroot is /var/www
Postscript
A simpler solution is to run:
PHP_PDO_SHARED=1 pecl install pdo_mysql