LAMP中的php编译安装

下载安装包:wget  http://cn2.php.net/distributions/php-5.6.29.tar.gz

10年积累的网站建设、成都网站制作经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站设计后付款的网站建设流程,更有鞍山免费网站建设让你可以放心的选择与我们合作。

php编译安装步骤:

一,配置编译参数./configure

./configure   \

>--prefix=/usr/local/php  \

>--with-apxs2=/usr/local/apache2/bin/apxs  \     //安装该参数后会出现php_module模块

>--with-config-file-path=/usr/local/php/etc  \

>--with-MySQL=/usr/local/mysql   \

>--with-libxml-dir  \

>--with-gd

>--with-jpeg-dir  \

>--with-png-dir \

>--with-freetype-dir \

>--with-iconv-dir \

>--with-zlib-dir \

>--with-bz2  \

>--with-openssl  \

>--with-mcrypt  \

>--enable-soap  \

>--enable-gd-native-ttf   \

>--enable-mbstring   \

>--enable-sockets   \

>--enable-exif    \

>--disable-ipv6

./configure编译之后遇到的一些错误信息:

1.configure: error: Cannot find OpenSSL's <evp.h>

解决方法:yum install -y  openssl  openssl-devel

2.checking for BZip2 in default path... not found

configure: error: Please reinstall the BZip2 distribution

解决方法:yum install -y bzip2 bzip2-devel

3.configure: error: jpeglib.h not found.

解决方法:yum install -y  libjpeg-turbo  libjpeg-turbo-devel

4.configure: error: png.h not found.

解决方法:yum install -y  libpng  libpng-devel

5.configure: error: freetype-config not found.

解决方法:yum  install  -y  freetype   freetype-devel

6.configure: error: mcrypt.h not found. Please reinstall libmcrypt.

解决方法:yum   install  -y   epel-release

  yum    install  -y  libmcrypt-devel

(因为Centos默认的yum源没有libmcrypt-devel这个包,只能借epel的yum源)

7.checking for xml2-config path...

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

解决方法:yum  install  -y  libxml2-devel

二,编译make

三,安装make install

安装完成后,还不能使用,还需要进一步配置一下

拷贝php配置文件:(在./configure配置参数时的目录下)

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

(这一步必须得有,要不然后面不能正常解析php文件)

LAMP中的php编译安装

修改apache配置文件

vi  /usr/local/apache2/conf/httpd.conf

1.找到:

<Directory "/usr/local/apache2//cgi-bin">

   AllowOverride None

   Options None

   Order allow,deny

   Denyfrom all

</Directory>

改为:

<Directory "/usr/local/apache2//cgi-bin">

   AllowOverride None

   Options None

   Order allow,deny

   Allowfrom all

</Directory>

说明:如果不修改这个地方,我们访问网站会禁止访问,显示403

2.找到: AddType application/x-gzip .gz .tgz

在该行下面添加: AddType application/x-httpd-php .php

说明:要想支持PHP脚本解析,必须要加上对应的类型

3.找到:

<IfModule dir_module>

   DirectoryIndex index.html index.htm

</IfModule>

改为:

<IfModule dir_module>

   DirectoryIndex index.html index.htmindex.php

</IfModule>

说明:增加针对php的索引,如果一个站点默认页为index.php,那么就得加上这个index.php的支持。

4.找到:

#ServerName  www.example.com:80

改为:

ServerName   localhost:80

说明:如果不去掉#,启动apache时,会有警告信息

5.去掉/user/local/apache2/conf/httpd.conf里#Include conf/extra/httpd-vhosts.conf的井号,解析localhost下的php提示404.

原因:/usr/local/apache2/confhttpd.conf下的php文件在doucmentroot=/usr/local/apache2/htdocs下;而/usr/local/apache2/conf/extra/httpd-vhosts.conf下的php文件在doucmentroot=/data/www下。两个路径不一样所以不能通用php文件

6.要想使用curl  localhost/1.php:要开启httpd服务,该命令才可以使用

本文题目:LAMP中的php编译安装
网页地址:https://www.cdcxhl.com/article44/jhdshe.html

成都网站建设公司_创新互联,为您提供网站排名App开发微信公众号小程序开发网站营销定制开发

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

网站托管运营