OS:ubuntu14.04
WEB Server:nginx1.7.5
PHP-5.9.4 php
wget http://cn2.php.net/distributions/php-5.5.9.tar.gz
tar zvxf php-5.5.9.tar.gz
cd php-5.5.9
apt-get install curl
apt-get install php5-curl
apt-get install libcurl4-gnutls-dev
sudo apt-get install libjpeg-dev
sudo apt-get install libmcrypt-dev
./configure --prefix=/usr/local/php --enable-fpm --with-mcrypt \
--enable-mbstring --disable-pdo --with-curl --disable-debug --disable-rpath \
--enable-inline-optimization --with-bz2 --with-zlib --enable-sockets \
--enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex \
--with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli \
--with-gd --with-jpeg-dir
make all install
/*
./configure’ ‘–prefix=/usr/local/php’ ‘–with-config-file-path=/etc’ ‘–with-mysql=/usr/local/mysql’ ‘–with-mysqli=/usr/local/mysql/bin/mysql_config’ ‘–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: error: xml2-config not found. Please check your libxml2 installation.
而我已經安裝過了libxml2,可是仍是有這個提示:
解決辦法:
# sudo apt-get install libxml2-dev html
錯誤二:
configure: error: Please reinstall the BZip2 distribution
而我也已經安裝了bzip2,網上找到得解決方案都是須要安裝bzip2-dev,但是11.10裏面沒有這個庫。
解決辦法:在網上找到bzip2-1.0.5.tar.gz,解壓,直接make ,sudo make install.(我使用的該源來自於http://ishare.iask.sina.com.cn/f/9769001.html) java
錯誤三:
configure: error: Please reinstall the libcurl distribution -easy.h should be in /include/curl/
解決辦法:
# sudo apt-get install libcurl4-gnutls-dev mysql
錯誤四:
configure: error: jpeglib.h not found.
解決辦法:
# sudo apt-get install libjpeg-dev nginx
錯誤五:
configure: error: png.h not found.
解決辦法:
# sudo apt-get install libpng-dev sql
錯誤六:
configure: error: libXpm.(a|so) not found.
解決辦法:
# sudo apt-get install libxpm-dev ubuntu
錯誤七:
configure: error: freetype.h not found.
解決辦法:
# sudo apt-get install libfreetype6-dev app
錯誤八:
configure: error: Your t1lib distribution is not installed correctly. Please reinstall it.
解決辦法:
# sudo apt-get install libt1-dev curl
錯誤九:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解決辦法:
# sudo apt-get install libmcrypt-dev socket
錯誤十:
configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore!
解決辦法:
# sudo apt-get install libmysql++-dev
錯誤十一:
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
解決辦法:
# sudo apt-get install libxslt1-dev
可見PHP源碼安裝以前須要先安裝這些依賴,詳細可見http://forum.ubuntu.org.cn/viewtopic.php?f=88&t=231159
如上錯誤都解決以後,再次./config….沒有錯誤以後,
# make
# sudo make install
Update config:
a.PHP
cd /usr/local/php cp etc/php-fpm.conf.default etc/php-fpm.conf vi etc/php-fpm.conf 修改 user = www-data group = www-data 若是www-data用戶不存在,那麼先添加www-data用戶 groupadd www-data useradd -g www-data www-datab.nginx
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; #default 這句不行 #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }Test:
<?php echo phpinfo(); ?>b.啓動php-fpm和nginx
sudo /usr/local/php/sbin/php-fpm sudo /usr/local/nginx/nginxc.訪問http://ip/index.php
參考:
http://www.nginx.cn/231.html