天天看點

Ubuntu 11.10 安裝 PHP, PHP-FPM, eAccelerator

###### 前期工作 ######

sudo apt-get update #先更新下#

sudo apt-get install make bison flex gcc patch autoconf git zip

sudo apt-get install libpng-dev libjpeg-dev libxml2-dev libevent-dev libcurl4-openssl-dev libmcrypt-dev libmysqlclient-dev libming-dev libfreetype6-dev libtool

######安裝Ming######

#上步成功的話,這一步可以省略#

wget http://jaist.dl.sourceforge.net/project/ming/Releases/ming-0.4.4.tar.gz

tar zxvf ming-0.4.4.tar.gz

cd ming-0.4.4

sudo ./configure

sudo make

sudo make install

###### 安裝memcached伺服器及用戶端 ######

sudo apt-get install memcached libmemcached-dev

啟動memcached

sudo memcached -d -m 64 -p 11211 -l 127.0.0.1 -u nobody -c 1024

memcached常用啟動參數描述:

-d:啟動一個守護程序,

-m:配置設定給Memcache使用的記憶體數量,機關是MB,預設是64MB,

-u:運作Memcache的使用者

-l:監聽的伺服器IP位址

-p:設定Memcache監聽的端口,預設是11211注:-p(p為小寫)

-c:設定最大并發連接配接數,預設是1024

-P:設定儲存Memcache的pid檔案注:-P(P為大寫)

-h 顯示幫助

###### 安裝PHP ######

wget http://jp.php.net/distributions/php-5.2.17.tar.gz

wget http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz

tar zvxf php-5.2.17.tar.gz

gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | sudo patch -d php-5.2.17 -p1

cd php-5.2.17

sudo ./configure --enable-fastcgi --enable-fpm --with-mcrypt --with-zlib --enable-mbstring --disable-pdo --with-mysql --with-mysqli --disable-debug --disable-rpath --enable-inline-optimization --enable-zip --with-zlib --enable-force-cgi-redirect -enable-discard-path

##--with-ming --with-curl --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --with-mhash --enable-xslt --with-pcre-regex --enable-pic##

sudo make

sudo make install

Installing PHP SAPI module: cgi

Installing PHP CGI binary: /usr/local/bin/

Installing FPM config: /usr/local/etc/php-fpm.conf

Installing init.d script: /usr/local/sbin/php-fpm

Installing PHP CLI binary: /usr/local/bin/

Installing PHP CLI man page: /usr/local/man/man1/

Installing build environment: /usr/local/lib/php/build/

Installing header files: /usr/local/include/php/

Installing helper programs: /usr/local/bin/

program: phpize

program: php-config

Installing man pages: /usr/local/man/man1/

page: phpize.1

page: php-config.1

Installing PEAR environment: /usr/local/lib/php/

[PEAR] Archive_Tar - installed: 1.3.7

[PEAR] Console_Getopt - installed: 1.2.3

[PEAR] Structures_Graph- installed: 1.0.3

[PEAR] XML_Util - installed: 1.2.1

[PEAR] PEAR - installed: 1.9.1

Wrote PEAR system config file at: /usr/local/etc/pear.conf

You may want to add: /usr/local/lib/php to your php.ini include_path

###### 修改配置檔案 ######

sudo cp /usr/local/src/php-5.2.17/php.ini-recommended /usr/local/lib/php.ini

sudo mkdir /etc/php/

sudo ln -s /usr/local/lib/php.ini /etc/php/php.ini

sudo ln -s /usr/local/etc/php-fpm.conf /etc/php/php-fpm.conf

#######安裝php擴充######

sudo pecl install memcache

sudo pecl install pdo_mysql

###### 安裝libgif-dev ######

wget http://ftp.cn.debian.org/debian/pool/main/g/giflib/libgif-dev_4.1.6-9_i386.deb

sudo dpkg -i libgif-dev_4.1.6-9_i386.deb

###### 安裝SwfEditor ######

wget http://iij.dl.sourceforge.jp/swfed/54007/swfed-0.51.tar.gz

tar zvxf swfed-0.51.tar.gz

cd swfed-0.51

sudo phpize

sudo ./configure

sudo make

#####安裝eAccelerator######

wget http://jaist.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.zip

unzip eaccelerator-0.9.6.1.zip

cd eaccelerator-0.9.6.1

sudo phpize

sudo ./configure --enable-eaccelerator=shared

sudo make

sudo make install

#####建立www使用者群組######

sudo groupadd www

sudo useradd -g www www

chmod +w /var/www

chown -R www:www /var/www