Apache运维架构之Apache+PHP(3)

4、编译安装php
[root@ansible php-5.6.18]# yum install libXpm-devel -y
[root@ansible tools]# tar xf php-5.6.18.tar.gz 
[root@ansible tools]# cd php-5.6.18
[root@ansible php-5.6.18]# ./configure \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local/mysql/ \
--with-libxml-dir=/usr/local/libxml2/ \
--with-png-dir=/usr/local/libpng/ \
--with-jpeg-dir=/usr/local/jpeg6/ \
--with-freetype-dir=/usr/local/freetype/ \
--with-gd=/usr/local/gd2/ \
--with-zlib-dir=/usr/local/zlib/ \
--with-mcrypt=/usr/local/libmcrypt/ \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-xpm-dir=/usr/lib64/ \
--enable-soap  \
--enable-mbstring=all \
--enable-sockets
[root@ansible php-5.6.18]# make && make install

5、apache配置
[root@ansible php-5.6.18]# vim /usr/local/apache2/conf/httpd.conf     
ServerName localhost
DirectoryIndex index.php index.html
AddType 
application/x-httpd-php .php .phtml 
AddType application/x-httpd-php-source .phps
Include conf/extra/httpd-vhosts.conf
LoadModule php5_module        modules/libphp5.so
User www 
Group www

[root@ansible php-5.6.18]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf 
# Virtual Hosts
 
<VirtualHost *:80>
    ServerAdmin  1335120568@qq.com
    DocumentRoot "/usr/local/apache2/htdocs/www"
    ServerName 
    ServerAlias martin1.com
    ErrorLog "logs/www-error_log"
    CustomLog "logs/www-access_log" common
</VirtualHost>
 
<VirtualHost *:80>
    ServerAdmin  1335120568@qq.com
    DocumentRoot "/usr/local/apache2/htdocs/blog"
    ServerName blog.martin1.com
    ErrorLog "logs/blog-error_log"
    CustomLog "logs/blog-access_log" common
</VirtualHost>
 
[root@ansible php-5.6.18]# mkdir -p /usr/local/apache2/htdocs/{www,blog}
[root@ansible php-5.6.18]# vim /usr/local/apache2/htdocs/www/index.php
<?php
phpinfo();
?>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/4e2f08e7121d2b8a1ada5eba254c2ccc.html