LAMP中的php编译安装

下载安装包: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文件)

修改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服务,该命令才可以使用

时间: 2024-12-11 10:43:24

LAMP中的php编译安装的相关文章

LAMP纯源码编译安装日志

一.LAMP构架的安装与经验技巧(源码安装好处.是便于管理,可以选定参数,可以使用新版本) 相关软件列表: # ls /soft/ | grep -E "*.gz|*.zip|*.xz|*.bz2"    apr-1.4.5.tar.gz    apr-util-1.3.12.tar.gz    autoconf-2.61.tar.gz    freetype-2.3.12.tar.gz    httpd-2.4.18.tar.bz2    jpegsrc.v6b.tar.gz    

Linux中 cmake-3.x 编译安装以及man page添加

首先回顾一下 cmake-2.x 的编译安装. ================ cmake-2.x编译安装说明 ================编译安装的命令: ./bootstrap --prefix=安装目录(默认为/usr/local) make make install(根据安装目录的不同,可能需要root权限) 执行脚本文件bootstrap时加上参数"--qt-gui",可编译生成GUI版cmake程序. 编译.安装完成后,编辑文件 /etc/profile ,将&quo

Spark入门实战系列--2.Spark编译与部署(中)--Hadoop编译安装

[注]该系列文章以及使用到安装包/測试数据 能够在<[倾情大奉送–Spark入门实战系列] (http://blog.csdn.net/yirenboy/article/details/47291765)>获取 1 编译Hadooop 1.1 搭建好开发环境 1.1.1 安装并设置maven 1.下载maven安装包.建议安装3.0以上版本号,本次安装选择的是maven3.0.5的二进制包,下载地址例如以下 http://mirror.bit.edu.cn/apache/maven/maven

lamp环境搭建之编译安装php

1,PRC (People's republic of China) timezone中设置的时间为中国时间. 2,php的官方镜像源,使用linux时可以直接下载的 http://cn2.php.net/distributions/php-5.6.30.tar.gz 3,编译安装php报错如下 configure: error: no acceptable C compiler found in $PATH 解决:yum安装gcc套件. 4,编译安装 ./configure 时报错,如下: c

lamp环境搭建之编译安装mysql

mysql 编译安装1,在网站上下载: wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.15.tar.gz 2,安装cmake yum安装即可.("CMake"这个名字是"cross platform make"的缩写,) 3,cmake使用报错: -- The CXX compiler identification is unknown CMake Error: your CXX compil

centos下LAMP之源码编译安装httpd

1 最好先安装组件 [[email protected] ~]# yum groupinstall additional development [[email protected] ~]# yum groupinstall development tool 2 安装ap1.5.2r(Apache Portable Runtime),安装apr-util 1.5.4工具 [[email protected] ~]wget http://mirrors.cnnic.cn/apache//apr/a

LAMP架构部署-- 三.编译安装PHP

LAMP组件介绍 LAMP是指Linux.Apache,Mysql以及PHP的简称,目前许多生产环境的都是用的LAMP架构,在网络应用和开发环境方面,LAMP组合是非常棒的,它们的结合提供了强大的功能. Linux作为底层的操作系统,提供了灵活且安全的应用平台,为其他的组件稳定运行提供了保障: Apache作为web服务器,提供了功能强大.稳定与支撑能力突出的web平台: Mysql也是一款优秀的数据库软件: PHP是一种开发脚本语言,可以嵌入HTML中,适用于web开发: 准备工作 操作系统:

LAMP 1.4 PHP编译安装

1.下载                                                                                                                                                                         切换到指定目录下 cd /usr/local/src 下载php wget http://cn2.php.net/distributions/php-5.

LAMP 1.4 PHP编译安装问题解决

在这一步,遇到如下错误:configure: error: xml2-config not found. Please check your libxml2 installation.解决办法是:# yum install -y libxml2-devel还有错误:configure: error: Cannot find OpenSSL's <evp.h>解决办法是:# yum install -y openssl openssl-devel错误:checking for BZip2 in