资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

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

解决方法: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.找到:

   AllowOverride None

   Options None

   Order allow,deny

   Denyfrom all

改为:

   AllowOverride None

   Options None

   Order allow,deny

   Allowfrom all

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

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

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

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

3.找到:

   DirectoryIndex index.html index.htm

改为:

   DirectoryIndex index.html index.htmindex.php

说明:增加针对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编译安装
地址分享:http://cdkjz.cn/article/jhdshe.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220