搜索
首页php教程php手册centos64位lamp配置第三步:编译php5.3.27

下载php-5.3.27.tar.gz,解压tar -zxvf php-5.3.27,确保已经安装了yum -y install wget gcc-c ncurses ncurses-devel cmake make perl bison openssl openssl-devel gcc* libevent libevent-devel libxml2 libxml2-devel libmcrypt libmcrypt-devel curl-deve

下载php-5.3.27.tar.gz,解压tar -zxvf php-5.3.27,确保已经安装了yum -y install wget gcc-c++ ncurses ncurses-devel cmake make perl bison openssl openssl-devel gcc* libevent libevent-devel libxml2 libxml2-devel  libmcrypt libmcrypt-devel curl-devel libpng-devel libtool-ltdl-devel libjpeg* libpng* freetype* zlib zlib-devel openldap openldap-devel libxslt-devel* bzip2-devel

执行:cp -frp /usr/lib64/libldap* /usr/lib/

安装mhash:

# tar zxvf mhash-0.9.9.tar.gz<br> # cd mhash-0.9.9

# mkdir -p /usr/local/mhash<br> # ./configure prefix=/usr/local/mhash<br> # make && make install<br>

安装libmcrpt:

wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz<br>

tar -zxvf libmcrypt-2.5.7.tar.gz <br> cd libmcrypt-2.5.7 <br> mkdir -p /usr/local/libmcrytp <br> ./configure prefix=/usr/local/libmcrytp/   #默认也可以<br> make<br> make install <br>

这些准备环境。

<br>

进入php-5.3.27目录,执行./configure,如果是在nginx之前编译,要去掉

<span><strong>--with-apxs2=/usr/local/apache/bin/apxs,--with-iconv=/usr/local/libiconv改为--with-iconv</strong></span>
:
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-openssl --with-zlib --with-bz2 --with-gettext --with-mhash --with-mcrypt --with-iconv=/usr/local/libiconv --with-curl --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-pdo --enable-gd-native-ttf --enable-bcmath --enable-mbstring --enable-zip --enable-soap --enable-sockets --enable-ftp --without-pear --enable-fpm --enable-inline-optimization
<br>

下面是参考:

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-iconv-dir=/usr/local/libiconv --with-libxml-dir=/usr --enable-xml --with-curl --with-curlwrappers --with-mhash --with-mcrypt=/usr/local/libmcrytp --with-gd --enable-gd-native-ttf --with-xsl --with-openssl --with-ldap --with-ldap-sasl --with-xmlrpc --without-pear --with-plugins=innobase --without-debug --with-charset=utf8 --with-collation=utf8_unicode_ci --with-extra-charsets=utf8 --with-pthread --enable-static --enable-safe-mode --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-thread-safe-client --with-mysqld-user=mysql --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-pdo --with-big-tables --without-debug --with-jpeg-dir=/usr/lib --with-png-dir --with-freetype-dir --with-zlib --enable-mbstring --with-pear --enable-mbregex --enable-zend-multibyte --enable-sockets --enable-soap --enable-exif --with-mhash=/usr/local/mhash --with-apxs2=/usr/local/apache/bin/apxs --enable-fpm --enable-inline-optimization<br>

完成后会看到thank you for use php字样

  make

make install

没有出现error就ok了。

cp php.ini-production /usr/local/php/etc/php.ini

sed -i 's/;date.timezone =/date.timezone = Asia/Shanghai/g' /usr/local/php/etc/php.ini<br> sed -i 's/short_open_tag = Off/short_open_tag = On/g' /usr/local/php/etc/php.ini<br> sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini<br> sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /usr/local/php/etc/php.ini<br> sed -i '262i output_buffering = On' /usr/local/php/etc/php.ini<br>

配置php-fpm:

cp sapi/fpm/init.d.php-fpm  /etc/rc.d/init.d/php-fpm

chmod +x /etc/init.d/php-fpm

chkconfig --add php-fpm

chkconfig php-fpm on

<br>

# cd /usr/local/php/etc/

# cp php-fpm.conf.default php-fpm.conf

# vi php-fpm.conf    //一般配置的依据如下

内存小于4G服务器(值可逐级递减):

修改如下参数:

pm=dynamic

pm.max_children=40

pm.start_servers=10

pm.min_spare_servers=10

pm.max_spare_servers=40

 ******************************

内存大于4G服务器(值可逐级递增):

修改如下参数:

pm=static

pm.max_children=100

<br>

<br>

安装pdo-mysql:

tar zxvf PDO_MYSQL-1.0.2.tgz<br> cd PDO_MYSQL-1.0.2/<br> /usr/local/php/bin/phpize<br> ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql<br> make && make install<br> tar zxvf PDO_MYSQL-1.0.2.tgz

cd PDO_MYSQL-1.0.2/ /usr/local/php/bin/phpize

./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql make && make install
<br>
修改Php.ini:

<br>

extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"

extension = "pdo_mysql.so"

 service php-fpm start

  vim /usr/local/apache/conf/httpd.conf

查找AddType

添加:AddType application/x-httpd-php .php

查找DirectoryIndex,在DirectoryIndex后面添加index.php

DirectoryIndex index.php index.html         查找:LoadModule php5_module modules/libphp5.so         如果没有就添加,使用phpinfo()测试,能输出php信息就ok了。         
声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热工具

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

WebStorm Mac版

WebStorm Mac版

好用的JavaScript开发工具

SublimeText3 英文版

SublimeText3 英文版

推荐:为Win版本,支持代码提示!

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

PhpStorm Mac 版本

PhpStorm Mac 版本

最新(2018.2.1 )专业的PHP集成开发工具