Home | Mirror | Search

2. 編譯安裝 php 與 php-fpm

提示

PHP 5.3.3 後續版本已經整合php-fpm 不需要打補丁再安裝.

2.1. php-5.2.x

http://php-fpm.org/downloads/

			
[root@freebsd1:~] cd /usr/src/
[root@freebsd1:/usr/src]

wget http://php-fpm.org/downloads/php-5.2.14-fpm-0.5.14.diff.gz
wget http://www.php.net/get/php-5.2.14.tar.gz/from/cn.php.net/mirror

[root@freebsd1:/usr/src] tar zxf php-5.2.14.tar.gz

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

[root@freebsd1:/usr/src] cd php-5.2.14


./configure --prefix=/usr/local/php-5.2.14 \
--with-config-file-path=/usr/local/php-5.2.14/etc \
--enable-fastcgi --enable-fpm \
--with-curl \
--with-gd \
--with-jpeg-dir=/usr/lib64 \
--with-iconv \
--with-mcrypt \
--with-zlib \
--with-pear \
--with-xmlrpc \
--with-openssl \
--with-mysql \
--with-mysqli \
--with-pdo-mysql \
--enable-zip \
--enable-sockets \
--enable-soap \
--enable-mbstring \
--enable-magic-quotes \
--enable-inline-optimization \
--enable-xml \
--enable-ftp

make && make install
			
			

配置php.ini與php-fpm.conf

			
cp php.ini-dist /usr/local/php-5.2.14/etc/php.ini
/usr/local/php-5.2.14/etc/php.ini

include_path = ".:/www/includes:/usr/local/php-5.2.14/lib/php"


vim /usr/local/php-5.2.14/etc/php-fpm.conf

    <value name="owner">www</value>
    <value name="group">www</value>


<value name="user">www</value>
<value name="group">www</value>


/usr/local/php-5.2.14/sbin/php-fpm start
			
			

2.2. php-5.3.x

安裝zlib
===========================================================
./configure
make test
make install

安裝gd
===========================================================
cd /usr/ports/graphic/gd
make install

安裝libpng
===========================================================
cd /usr/ports/graphics/png
make install
===========================================================

安裝jpeg
===========================================================
cd /usr/ports/graphics/jpeg
make install
===========================================================

安裝freetype
===========================================================
cd /usr/ports/print/freetype
make install
			
./configure --prefix=/usr/local/php-5.3.5 \
--with-config-file-path=/usr/local/php-5.3.5/etc \
--with-config-file-scan-dir=/usr/local/php-5.3.5/etc/conf.d \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--with-pear \
--with-curl \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-iconv \
--with-mcrypt \
--with-mhash \
--with-zlib \
--with-xmlrpc \
--with-xsl \
--with-openssl \
--with-mysql \
--with-mysqli \
--with-pdo-mysql \

--disable-debug \
--enable-zip \
--enable-sockets \
--enable-soap \
--enable-mbstring \
--enable-magic-quotes \
--enable-inline-optimization \
--enable-memory-limit
--enable-xml \

--enable-ftp \
--enable-exif \
--enable-wddx \
--enable-bcmath \
--enable-calendar \
--enable-sqlite-utf8 \
--enable-shmop \
--enable-dba \
--enable-sysvsem \
--enable-sysvshm \
--enable-sysvmsg

make
make install
			

php.ini

include_path=.:/usr/local/php-5.3.5/lib/php
			

php-fpm.conf

cp /usr/local/php-5.3.5/etc/php-fpm.conf.default /usr/local/php-5.3.5/etc/php-fpm.conf
cp /usr/src/php-5.3.5/sapi/fpm/init.d.php-fpm /usr/local/etc/rc.d/php-fpm
chmod +x /usr/local/etc/rc.d/php-fpm

vim /usr/local/php-5.3.5/etc/php-fpm.conf
pid = run/php-fpm.pid

user = www
group = www

pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
			
comments powered by Disqus