安装环境:ubuntu 桌面版12.10
安装版本:mysql-5.5.28.tar.gz
使用root用户安装
su root
在出现的提升中输入密码
1.安装必备工具
sudo apt-get install autoconf
sudo apt-get install libxml2-dev
sudo apt-get install bzip2
sudo apt-get install libcurl3-openssl-dev
apt-get install php5-gd
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libjpeg-dev
sudo apt-get install libpng-dev
sudo apt-get install libxpm-dev
sudo apt-get install libfreetype6-dev
sudo apt-get install libt1-dev
sudo apt-get install libmcrypt-dev
sudo apt-get install libmysql++-dev
sudo apt-get install libxslt1-dev
apt-get install libbz2-dev
2.安装php
2.1 下载php
cd /usr/local/src
wget http://cn2.php.net/get/php-5.4.9.tar.gz/from/this/mirror -O php-5.4.9.tar.gz
2.2 解压php
tar -zvxf php-5.4.9.tar.gz
2.3、配置编译
mkdir /usr/local/php
cd /usr/local/src/php-5.4.9
./configure -prefix=/usr/local/php -with-config-file-path=/etc -with-mysql=/usr/local/mysql -with-iconv-dir=/usr/local -with-freetype-dir -with-jpeg-dir -with-png-dir -with-zlib -with-libxml-dir=/usr -enable-xml -disable-rpath -enable-safe-mode -enable-bcmath -enable-shmop -enable-sysvsem -enable-inline-optimization -with-curl -with-curlwrappers -enable-mbregex -enable-fpm -enable-mbstring -with-mcrypt -with-gd -enable-gd-native-ttf -with-openssl -with-mhash -enable-pcntl -enable-sockets -with-xmlrpc -enable-zip -enable-soap
./configure --prefix=/opt/php5 --with-config-file-path=/opt/php5/etc --with-curl --with-pear --with-gd --with-jpeg-dir --with-png-dir --with-zlib --with-xpm-dir --with-freetype-dir --with-t1lib --with-mcrypt --with-mhash --with-mysql --with-mysqli --enable-pdo --with-pdo-mysql --with-openssl --with-xmlrpc --with-xsl --with-gettext --with-fpm-user=www-data --with-fpm-group=www-data --enable-fpm --enable-exif --enable-wddx --enable-zip --enable-bcmath -with-bz2 --enable-calendar --enable-ftp --enable-mbstring --enable-soap --enable-sockets --enable-shmop --enable-dba --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-debug --enable-maintainer-zts --enable-embed
2.4、编译中出现的错误
2.4.1、运行apt-get install libxpm-dev 还出现以下错误
configure: error: libXpm.(a|so) not found.
不是缺少东西,是编译程序找不到文件。用命令查找文件
cd /usr/lib
find /usr/lib -name "libXpm*"
出现如下
/usr/lib/i386-linux-gnu/libXpm.so.4.11.0
/usr/lib/i386-linux-gnu/libXpm.so
/usr/lib/i386-linux-gnu/libXpm.so.4
/usr/lib/i386-linux-gnu/libXpm.a
然后ln连接
ln -s /usr/lib/i386-linux-gnu/libXpm.a .
ln -s /usr/lib/i386-linux-gnu/libXpm.so .
ln -s /usr/lib/i386-linux-gnu/libXpm.so.4 .
ln -s /usr/lib/i386-linux-gnu/libXpm.so.4.11.0 .
完成后再编译
待定。。。。
参考
http://www.cnblogs.com/1110111abc/archive/2012/09/22/2698259.html