LAMP中的php编译安装

发布时间:2020-08-05 08:58:04 作者:望月jin
来源:网络 阅读:342


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

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

   Deny from all

</Directory>

改为:

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

   AllowOverride None

   Options None

   Order allow,deny

   Allow from 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.htm index.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服务,该命令才可以使用


推荐阅读:
  1. LAMP编译安装
  2. LAMP编译安装1

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

php lamp 编译安装

上一篇:Python3优雅操作-时间处理与定时任务

下一篇:标准库系列之xml模块

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》