View Single Post
  #2   IP: 180.125.50.245
Old 2016-05-25, 02:45 PM
topvip topvip is offline
超级版主
 
Join Date: 2006-01-04
Posts: 1206
topvip 正向着好的方向发展
Default

安装 apache
第一步:
cp -r /abiao/apr-1.4.6 /abiao/httpd-2.4.7/srclib/apr
cp -r /abiao/apr-util-1.4.1 /abiao/httpd-2.4.7/srclib/apr-util

或:
cd /abiao
cp -r apr-1.4.6 httpd-2.4.7/srclib/apr
cp -r apr-util-1.4.1 httpd-2.4.7/srclib/apr-util


第二步:
cd /abiao/pcre-8.34
./configure && make && make installl


第三步:
./configure --prefix=/usr/local/apache2/ --sysconfdir=/usr/local/apache2/etc/ --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared

第四步:
make && make install

第五步,启动apache:/usr/local/apache/bin/apachectl start


把新编译安装的apache启动脚本复制到系统脚本目录下:
cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd


编辑 /etc/init.d/httpd 文件,在首行 #!/bin/sh 下面加入两行:
# chkconfig: 35 85 15 //修改脚本用于在运行界别35下自启动,并指定启动脚本序号为85,关闭脚本序号为15

# description: Activates/Deactivates Apache 2.4.7


将 Apache 加入开机自动启动:
chkconfig --add httpd
chkconfig httpd on

第六步:修改防火墙设置
如果要从外网访问,还需要设置防火墙,否则外网是无法访问的,默认情况下,linux只开启22端口的,所以要开放80端

vi /etc/sysconfig/iptables
#这里是打开防火墙设置,在22端口的下面一行添加下面这行代码,如果要开启8080端口只需要把80改成8080既可
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT

service iptables restart //重启防火墙服务

最后一步,启动编译好的 Apache 2.4.7:
service httpd start

----
启用虚拟主机:
vi /usr/local/apache2/etc/httpd.conf,

# Virtual hosts

# Include etc//extra/httpd-vhosts.conf
改成
# Virtual hosts

Include etc/extra/httpd-vhosts.conf

---
修改网站首页默认文件名:找到
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
改:
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
=======================================






===============
安装php


vi /usr/local/gd2/include/gd_io.h
找到
}
gdIOCtx;
改为:
void (*data);
}
gdIOCtx;


---
cd /abiao/php-5.6

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml-dir=/usr/include/libxml2 --with-config-file-path=/usr/local/apache2/conf --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-gd=/usr/local/gd2/ --enable-gd-native-ttf --with-zlib --with-mcrypt=/usr/local/libmcrypt/ --with-pdo-mysql=/usr/local/mysql --enable-shmop --enable-soap --enable-sockets --enable-wddx --enable-zip --with-xmlrpc --enable-fpm --enable-mbstring --with-zlib-dir --with-bz2 --with-curl --enable-exif --enable-ftp --with-jpeg-dir=/usr/lib --with-png-dir=/usr/local/libpng/ --with-freetype-dir=/usr/local/freetpye/ --with-xpm-dir=/usr/lib

make && make install
---
生成php.ini
cp /abiao/php-5.6.21/php.ini-production /usr/local/php/etc/php.ini

查看php有没有安装成功:
vi /usr/local/apache2/etc/httpd.conf
找到LoadModule rewrite_module modules/mod_rewrite.so,看它下边有没有
LoadModule php5_module modules/libphp5.so、
如有上边一行, 说明php安装成功 ,否则就没,就要重新安装了。
--
在httpd.conf文件中找到</IfModule>,在它下边一行加:
AddType application/x-httpd-php .php .phtml .phps

重新启动apache服务:
/usr/local/apache2/bin/apachectl stop
/usr/local/apache2/bin/apachectl start

===========

====================
centos php5.6
error: Please reinstall the BZip2 distribution

Fix: yum install bzip2-devel
-------
error: Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/

Fix: yum install curl-devel
----
error: jpeglib.h not found.

Fix: yum install libjpeg-devel
--------
error: png.h not found.

Fix: yum install libpng-devel
---------
error: freetype.h not found
error: freetype-config not found.

Fix: yum install freetype-devel

----------
error: mcrypt.h not found. Please reinstall libmcrypt.
ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt

---
安装GD库:

./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/ --with-freetype=/usr/local/freetype/ --with-png=/usr/local/libpng/




LibGD 2.1.1: http://libgd.github.io/
download: https://github.com/libgd/libgd/releases

====================
安装memcache模块(客户端)
cd memcache-3.0.8

/usr/local/php/bin/phpize

./configure --with-php-config=/usr/local/php/bin/php-config

make && make install

安装mcrypt模板第二步
cd /abiao/php-5.6.21/ext/mcrypt/

/usr/local/php/bin/phpize

./configure --with-php-config=/usr/local/php/bin/php-config
--with-mcrypt=/usr/local/libmcrypt/

make && make install

注意,这个模块的第二步是等php成功安装后能才操作的。

修改/usr/local/php/etc/php.ini
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20131226"
打开注释,并加下边2条
extension="memcache.so";
extension="mcrypt.so";
extension="opcache.so";

重启apache后,在phpinfo中就可以找到这两个模块了


--
安装memcache模块(服务器端)

Last edited by topvip : 2016-05-25 at 10:39 PM
Reply With Quote