Ubuntu install php5.61. download the php-5.5.6 ~ /Downloadscd ~ /Downloadswgethttp: // cn2.php.net/distributions/php-5.5.6.tar.gz2.install a few sudoa ubuntu installation php 5.5.6
1. download php-5.5.6 ~ /Downloads
Cd ~ /Downloads
Wget http://cn2.php.net/distributions/php-5.5.6.tar.gz
2. install some modules required during php compilation
Sudo apt-get-y install libxml2 libxml2-dev: autoconf libjpeg-dev libpng-dev php5-gd libmcrypt-dev
Sudo apt-get-y install bzip2 libbz2-dev curl libcurl4-gnutls-dev libfreetype6-dev
3. extract
Tar-zxf php-5.5.6.tar.gz
4. Compile and install
. /Configure -- prefix =/usr/local/php-5.5.6 -- with-apxs2 =/usr/local/apache -2.4.7/bin/apxs -- with-libxml-dir =/usr/include/libxml2 -- with-config-file-path =/usr/local/php-5.5.6/etc/--- gd -- enable-gd-native-ttf -- with-zlib -- with-mcrypt --- mysql -- enable-shmop -- enable-soap -- enable-sockets -- enable-wddx -- enable- zip -- with-xmlrpc -- enable-fpm -- enable-mbstring -- with-zlib-dir -- with-bz2 -- with-curl -- enable-exif -- enable-ftp -- with-iconv -- enable- xml -- enable-inline-optimization -- enable-bcmath -- enable-sysvsem -- with-openssl -- with-gettext -- enable-pcntl -- enable-session
Make
Sudo make install
5. configuration
Sudo rm-rf/etc/php5/fpm
Sudo update-rc.d-f php5-fpm remove
Sudo rm/etc/init. d/php5-fpm
Cd/usr/local/php-5.5.6/etc
Sudo cp ~ /Downloads/php-5.5.6/php. ini-production php. ini
Ln-s php. ini/etc/php. ini
Sudo cp php-fpm.conf.default php-fpm.conf
Edit php-fpm.conf
# Cancel the semicolon
Pid = run/php-fpm.pid
Save and exit
Add a group: nobody for php-fpm
Groupadd nobody
Set the startup of php-fpm
Sudo cp ~ /Downloads/php-5.5.6/sapi/fpm/init. d. php-fpm/etc/init. d/php-fpm
Sudo chmod + x/etc/init. d/php-fpm
?
6. configure apache 2
# How does one configure apache to use php as a module?
# Vi/usr/local/apache/conf/httpd. conf?
?
? ?? # Add php handler here?
? ? AddType application/x-httpd-php. php. phtml
? ? AddType application/x-httpd-php-source. phps
? ? PHPIniDir "/etc "?
?
# Disable the file list function?
# Options Indexes FollowSymLinks?
Options FollowSymLinks
# Allow configuration rewriting?
# AllowOverride None?
AllowOverride All
Require all granted
?
? ? DirectoryIndex index.html index. php
Reprinted from: http://www.cnblogs.com/lwysoft/archive/2012/11/25/2787759.html
?