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 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 use apt- get installed apache2, php5, pear and mysql5. In order to facilitate subsequent installation, make and libmysqlclient were also added
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 cannot find the installation source in Ubuntu's apt, so installing this extension through pecl is very simple - 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, I encountered some problems when installing pdo_mysql. If I ran pecl install pecl_mysql directly, some errors would appear. After searching, I found that it was 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 the code snippet in configure to determine whether the pdo extension has been installed, and continue running:
phpize
./configure
make
make install
and then add the following line again to the two previously mentioned php.ini
extension=pdo_mysql.so.
After restarting apache, php5 + pdo_mysql will be installed on ubuntu. The documentroot is /var/www
postscript. A simpler solution is Run:
PHP_PDO_SHARED=1 pecl install pdo_mysql