Linux下 PHP环境安装
您需要以下安装包:
1. 字体引擎,freetype-2.1.10.tar.gz2. JPEG 图形库,jpegsrc.v6b.tar.gz
3. PNG图形库,libpng-1.2.8-config.tar.gz
4. 数据压缩库,zlib-1.2.3.tar.gz
5. 加密算法扩展库,libmcrypt-2.5.7.tar.gz
6. PHP的源码包,php-5.3.3.tar.gz6
yum install gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*
创建扩展lib文件的安装文件夹
sudo mkdir –p /usr/local/web sudo mkdir -p /usr/local/web/lib #存放扩展lib目录
安装数据压缩库zlib,安装目录:/usr/local/web/lib/zlib
sudo tar zvxf zlib-1.2.3.tar.gz cd zlib-1.2.3 sudo ./configure --prefix=/usr/local/web/lib/zlib sudo make CFLAGS=-fpic sudo make install <span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);"> </span>
安装JPEG 图形库,安装目录:/usr/local/web/lib/jpeg
sudo tar zxvf jpegsrc.v6b.tar.gz cd jpeg-6b sudo ./configure --prefix=/usr/local/web/lib/jpeg sudo make sudo mkdir /usr/local/web/lib/jpeg #创建目录 sudo mkdir /usr/local/web/lib/jpeg/include sudo mkdir /usr/local/web/lib/jpeg/lib sudo make install-lib sudo mkdir /usr/local/web/lib/jpeg/bin sudo mkdir /usr/local/web/lib/jpeg/man sudo mkdir /usr/local/web/lib/jpeg/man/man1 sudo make install
PNG图形库,安装目录:/usr/local/web/lib/libpng
sudo tar zxvf libpng-1.2.8-config.tar.gz cd libpng-1.2.8-config sudo ./configure --prefix=/usr/local/web/lib/libpng sudo make CFLAGS=-fpic sudo make install
字体引擎,安装目录:/usr/local/web/lib/freetype
sudo tar zxvf freetype-2.1.10.tar.gz cd freetype-2.1.10 sudo ./configure --prefix=/usr/local/web/lib/freetype sudo make sudo make install
加密算法扩展库,安装目录:/usr/local/web/lib/ libmcrypt
sudo tar xzvf libmcrypt-2.5.7.tar.gz cd libmcrypt-2.5.7 sudo ./configure --prefix=/usr/local/web/lib/libmcrypt sudo make sudo make install
安装PHP
sudo tar zxvf php-5.3.3.tar.gz cd php-5.3.3 sudo ./configure --prefix=/usr/local/web/php.5.3.3 --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib --with-gd --with-freetype-dir=/usr/local/web/lib/freetype --with-jpeg-dir=/usr/local/web/lib/jpeg --with-png-dir=/usr/local/web/lib/libpng --with-iconv --enable-fpm --enable-cgi --enable-static --enable-maintainer-zts --enable-zend-multibyte --enable-inline-optimization --enable-sockets --enable-wddx --enable-zip --enable-calendar --enable-bcmath --enable-ftp --enable-soap --enable-mbstring --without-sqlite --disable-ipv6 --disable-debug --with-mcrypt sudo make sudo make install我们已经准备了两个php.ini配置文件和php-fpm.conf配置文件,默认的配置一般不能满足于我们的需求(如果您没有,那不需要拷贝)。将配置文件拷贝
sudo cp ../php.ini /usr/local/web/php.5.3.3/lib/php.ini sudo cp ../php-fpm.conf /usr/local/web/php.5.3.3/etc/php-fpm.conf sudo chmod -R 777 /usr/local/web/php.5.3.3/var/log/设置linux的连接数最大值,默认是1024. 在高负载下要设置为更高,但最高只能为65535。由于重启后失效,可以加入/etc/rc.d/rc.local开机就启动
ulimit -SHn 65535 启动PHP fpm进程 [plain] view plaincopyprint? /usr/local/web/php.5.3.3/sbin/php-fpm 查看PHP fpm进程 [plain] view plaincopyprint? ps –ef | grep php-fpm #查看PHP进程 管理PHP [plain] view plaincopyprint? #启动 /usr/local/web/php.5.3.3/sbin/php-fpm #重启 kill -USR2 `cat /usr/local/web/php.5.3.3/var/run/php-fpm.pid` #停止 kill -INT `cat /usr/local/web/php.5.3.3/var/run/php-fpm.pid`
谢谢关注websites博客!