码迷,mamicode.com
首页 > Web开发 > 详细

LAMP环境搭建之php安装

时间:2018-04-12 13:29:57      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:lamp   php   

PHP官网www.php.net
当前主流版本为5.6/7.1

下载php

cd /usr/local/src/ 
 wget http://cn2.php.net/distributions/php-5.6.30.tar.gz

解压源码包

tar zxf php-5.6.30.tar.gz

配置编译参数

cd php-5.6.30
 ./configure  --prefix=/usr/local/php  --with-apxs2=/usr/local/apache2.4/bin/apxs  --with-config-file-path=/usr/local/php/etc   --with-mysql=/usr/local/mysql  --with-pdo-mysql=/usr/local/mysql  --with-mysqli=/usr/local/mysql/bin/mysql_config  --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
// --with-apxs2  apache的一种工具,它可以自动的将扩展模块放到apache的modules目录下,并且在它的配置文件里加上一行
//--with-config-file-path  指定php配置文件的路径
//--with-mysql   指定mysql路径

编译安装

make && make install

安装报错:

错误1:
configure: error: xml2-config not found. Please check your libxml2 installation.
解决办法:
yum install -y libxml2-devel
错误2:
checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution
解决办法:
yum install -y bzip2-devel
错误3:
configure: error: jpeglib.h not found.
解决办法:
yum install -y 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 libmcrypt-devel

拷贝配置文件

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

libphp5.so

du -sh /usr/local/apache2.4/modules/libphp5.so 
37M /usr/local/apache2.4/modules/libphp5.so
这个就是我们想要的扩展模块,apache和php相结合是通过.so

查看加载的模块

/usr/local/php/bin/php -m

LAMP环境搭建之php安装

标签:lamp   php   

原文地址:http://blog.51cto.com/chenshengsheng/2097313

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!