ubuntu 裝配 php 5.5.6

來源:互聯網
上載者:User
ubuntu 安裝 php 5.5.6

1.下載 php-5.5.6 到 ~/downloads

cd ~/downloads

wget http://cn2.php.net/distributions/php-5.5.6.tar.gz

2.安裝 php編譯過程中需要用的的一些模組

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.解壓

tar -zxf php-5.5.6.tar.gz

4.編譯並安裝

./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/ --with-gd --enable-gd-native-ttf --with-zlib --with-mcrypt --with-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.配置

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

編輯 php-fpm.conf

#取消前面的分號

pid = run/php-fpm.pid

儲存並退出

為php-fpm添加一個group:nobody

groupadd nobody

設定 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.配置 apache 2

#配置apache以module方式使用php?

# vi /usr/local/apache/conf/httpd.conf?

?

? ??#此處添加php handler?

? ? AddType application/x-httpd-php .php .phtml

? ? AddType application/x-httpd-php-source .phps

? ? PHPIniDir "/etc"?

?

#禁止檔案清單功能?

#Options Indexes FollowSymLinks?

Options FollowSymLinks

#允許配置重寫?

#AllowOverride None?

AllowOverride All

Require all granted

?

? ? DirectoryIndex index.html index.php

轉載自:http://www.cnblogs.com/lwysoft/archive/2012/11/25/2787759.html

?

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.