PHP Compile and Install

1. Depend Libs

$ sudo apt-get install gcc
$ sudo apt-get install autoconf
$ sudo apt-get install libxml2-dev
$ sudo apt-get install libmysqlclient-dev
$ sudo apt-get install libmcrypt-dev


2. Compile and Install

$ wget http://cn.php.net/get/php-5.3.3.tar.gz/from/this/mirror
$ tar -xzf mirror
$ cd php-5.3.3
$ ./configure –help
$ ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs
   --with-mysql=/usr/local/mysql --enable-mbstring --enable-mcrypt
   --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql
$ make
$ sudo make install


3. Mysql Socket

$ sudo cp php.ini-development /usr/local/php/lib/php.ini
$ sudo vi /usr/local/php/lib/php.ini

mysql.default_socket = /var/run/mysqld/mysqld.sock

Posted in PHP, Ubuntu | Tagged , | Leave a comment