Centos 7 下Apache2.4关联php5.6.10

准备文件:
这里写图片描述
上传到服务器,保存到usr/local/bin/soft/php_linux/php-5.6.10.tar.bz2
1,安装步骤:
1.1解压
# tar jxvf php-5.6.10.tar.bz2
1.2配置
#./configure –prefix=/work/installed/php –with-apxs2=/work/installed/apache/bin/apxs –with-config-file-path=/usr/local/php –enable-xml –disable-rpath –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –with-curl –enable-mbregex –enable-fpm –enable-mbstring –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –enable-opcache –with-pdo-mysql –enable-maintainer-zts
在配置中可能会出现以下错误:

“configure: error: xml2-config not found. Please check your libxml2 installation.”

“configure: error: Cannot find OpenSSL's”

“checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/”

“checking for the location of libjpeg... no
checking for the location of libpng... no
checking for the location of libXpm... no
checking for FreeType 2... no
checking for T1lib support... no
checking whether to enable truetype string function in GD... yes
checking whether to enable JIS-mapped Japanese font support in GD... no
If configure fails try --with-vpx-dir=
If configure fails try --with-jpeg-dir=
configure: error: png.h not found.”

是因为缺少依赖包,执行以下命令即可:
#yum install libxml2 libxml2-devel
#yum install openssl openssl-devel
#yum install curl curl-devel
#yum install libjpeg libjpeg-devel libpng libpng-devel

安装完成后可以:
#make
#make install

2.修改apache2.4的httpd.conf
将DirectoryIndex index.html改为DirectoryIndex index.html index.php
并在类似的地方加上AddType application/x-httpd-php .php
保存退出。

重启服务器

你可能感兴趣的:(web开发)