php5.6 源码安装过程

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php5.6 源码安装过程相关的知识,希望对你有一定的参考价值。


安装php之前需要安装好apache和mysql.


(1)、下载和php软件包和解压

cd /usr/local/src

wget http://cn2.php.net/distributions/php-5.6.18.tar.gz/from/this/mirror -O php-5.6.18.tar.gz

tar -zxvf php-5.6.18.tar.gz



(2)、安装GCC和各种编译工具

yum install make apr* autoconf automake gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel gd  kernel keyutils  patch  perl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch


(3)、配置、编译、安装

cd php-5.6.18

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache24/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif --with-curl --enable-json --disable-ipv6


如果在配置编译参数过程中有错误,可能是缺少了某项开发包,将其补上即可,如:


错误信息:

configure: error: freetype-config not found.


解决办法:

yum install freetype-devel


没有错误了,就可以编译(make)和安装(make install)了。

make && make install


(4)、配置php.ini和配置Apache的配置文件httpd.conf

cp php.ini-production /usr/local/php/etc/php.ini
vim /usr/local/apache24/conf/httpd.conf


找到:

AddType application/x-gzip .gz .tgz


添加:

AddType application/x-httpd-php .php


找到:

 <IfModule dir_module>

     DirectoryIndex index.html

 </IfModule>

修改:

 <IfModule dir_module>

     DirectoryIndex index.html index.htm index.php

 </IfModule>

 

 (5)、重启Apache服务器,测试是否解析php

/usr/local/apache24/bin/apachectl -k restart
 
vim /usr/local/apache24/htdocs/info.php

编写如下代码:

<?php
   phpinfo();
?>


测试(假如ip是:192.168.1.110):

http://192.168.1.110/info.php


参考:http://php.net/manual/zh/install.unix.apache2.php


本文出自 “balich” 博客,请务必保留此出处http://balich.blog.51cto.com/6641781/1743499

以上是关于php5.6 源码安装过程的主要内容,如果未能解决你的问题,请参考以下文章

工具安装-CentOS源码安装php5.6

centos7源码安装php5.6并安装pthreads扩展

linux下编译安装配置php5.6.30过程

php5.6编译安装apache

lnmp源码安装-脚本执行

unbuntu 安装php5.6