编译安装LAMP之PHP

释放双眼,带上耳机,听听看~!

编译安装php-5.5.38:(相关包可以到http://www.php.net/ 下载)

1.安装前准备:

1)想让编译的php支持mcrypt扩展,需要装两个包(这两个包需要额外下载):

#rpm -ivh libmcrypt-2.5.8-9.el6.i686.rpm

#rpm -ivh libmcrypt-devel-2.5.8-9.el6.i686.rpm

2)如果出现出现configure:error:xml2-config not found错误:

# rpm -ivh libxml2-2.7.6-21.el6_8.1.i686.rpm

#rpm -ivh libxml2-devel-2.7.6-21.el6_8.1.i686.rpm

2.将源码包下载至本地,开始安装

# tar xf php-5.5.38.tar.bz2

#cd php-5.5.38

#./configure –prefix=/usr/local/php –with-mysql=/usr/local/mysql –with-openssl –with-mysqli=/usr/local/mysql/bin/mysql_config –enable-mbstring –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml  –enable-sockets –with-apxs2=/usr/local/apache/bin/apxs –with-mcrypt  –with-config-file-path=/etc –with-config-file-scan-dir=/etc/php.d –with-bz2  –enable-maintainer-zts

(释义:

–prefix=/usr/local/php    指定php安装目录;

–with-mysql=/usr/local/mysql    mysql安装目录,对mysql的支持;

–with-openssl    增加openssl的支持;

–with-mysqli=/usr/local/mysql/bin/mysql_config    mysqlin扩展技术,不仅可以调    用MySQL的存储过程,处理MySQL事务,而且可以使访问数据库工作变得稳定;

–enable-mbstring    多字节字符串的支持;

–with-freetype-dir    打开对freetype字体库的支持;

    –with-jpeg-dir    打开对jpeg格式图片的支持;

–with-png-dir    打开对png图片的支持;

–with-zlib    打开对zlib库的支持;

–with-libxml-dir=/usr    打开libxml2库的支持;

–enable-xml    打开对xml的支持;

–enable-sockets    打开socket支;

–with-apxs2=/usr/local/apache/bin/apxs    整合apache,apxs功能是使用mod_so中        的LoadModule指令,加载指定模块到apache,要求apache 要打开SO模块;

–with-mcrypt    算法;

–with-config-file-path=/etc    指定php.ini(配置文件)位置;

–with-config-file-scan-dir=/etc/php.d    是搜索下面的ini文件与php.ini一起使用;

–with-bz2    打开对bz2文件的支持;

–enable-maintainer-zts    启用线程安全

#make

#make install

3.为php提供配置文件

# cd php-5.5.38

# cp php.ini-production /etc/php.ini

至此,php安装结束!

【转自慕课】https://www.imooc.com

PHP

nginx对PHP文件报File not found.错

2022-3-1 20:09:07

PHP

Request.php-1

2022-3-1 20:26:51

搜索