LAMP 1.4 PHP编译安装

1.下载                                                                                                                                                                        

切换到指定目录下

cd /usr/local/src

 

下载php

wget http://cn2.php.net/distributions/php-5.4.44.tar.gz

 

 PHP 官方下载地址:http://www.php.net/downloads.php

 

解压缩

tar zxf php-5.4.44.tar.gz

 

2.配置编译参数                                                                                                                                                     

编译参数过程中会出现的错误

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 default path... not found
configure: error: Please reinstall the BZip2 distribution
解决办法

yum install -y bzip2 bzip2-devel

 

configure: error: png.h not found.
解决办法

yum install -y libpng libpng-devel

 

configure: error: freetype.h not found.
解决办法

 yum install -y freetype freetype-devel

 

configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解决办法

yum install -y epel-release
yum install -y libmcrypt-devel

 

 configure: error: jpeglib.h not found.

解决办法

yum install libjpeg-devel -y

 

切换到该目录下

 cd php-5.4.44

 

编译参数

 ./configure \
--with-apr=/usr/local/apr \
--prefix=/usr/local/php \
--with-apxs2=/usr/local/apache2/bin/apxs \
--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
echo $?

 

编译

make
echo $?

 

安装

make install
echo $?

 

拷贝php配置文件

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

 

修改apache配置文件

vim /usr/local/apache2/conf/httpd.conf
1.找到 #ServerName www.example.com:80
改为ServerName www.example.com:80

2.找到:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
改为:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>

3.找到<IfModule dir_module>
    DirectoryIndex index.html 
</IfModule>
改为
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

4.找到AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
改为
AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php

5.找到
#Include conf/extra/httpd-vhosts.conf
改为
Include conf/extra/httpd-vhosts.conf

 

修改配置文件

 

vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
mkdir /data/www
把最下面两段修改为
<VirtualHost *:80>
    DocumentRoot "/data/www"
    ServerName www.wangshaojun.com
    ServerAlias www.denny.com
   # ErrorLog "logs/dummy-host.example.com-error_log"
   # CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>

 

查看配置文件是否有问题

/usr/local/apache2/bin/apachectl -t

显示Syntax OK 说明配置没有问题,那么启动服务

 /usr/local/apache2/bin/apachectl start

 

查看有没有进程

 ps aux |grep httpd

 

posted @ 2015-12-04 02:04  dennyLinux  阅读(237)  评论(0编辑  收藏  举报