Linux下Apache2+php5+MySQL的整

Linux Apache2 + php5 +MySQL 的整合
1、安装软件版本
软件
安装文件
安装目录
APACHE
httpd-2.2.6.tar.gz
/usr/local/apache2
PHP
php-5.2.5.tar.gz
/usr/local/php
MYSQL
mysql-5.0.45-linux-i686.tar.gz
/usr/local/mysql
2、安装 APAHCE2 HTTP
# tar –zxvf httpd-2.2.6.tar.gz
# cd httpd-2.2.6
# ./configure   --prefix=/usr/local/apache2  --enable-so   --enable-rewrite   --enable-module-so   --enable-ssl
# make
# make install
编译安装完成后,启动apache ,测试一下是否安装成功。
# cd /usr/local/apache2/bin
# ./apachectl start                //如果没有报错,就说明安装成功。
3、安装 PHP
# tar -zxvf php-5.2.5.tar.gz
# cd php-5.2.5
#./configure  --prefix=/usr/local/php  --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql  --with-config-file-path=/usr/local/lib --enable-track-vars  --with-xml
# make                   //编译装载的文件
# make test          //查 看一下是否安装成功。
# make install     //安装编译好的文件
注:
·   apache mysql 是根据你安装的目录名变,如: apache /usr/local/apache2/bin/apxs MySQL =/usr/local/mysql  
·   enable-track-vars 表示为启动 cookie get/post 等追踪功
4、配置 APACHE
安装完成后,修改apache的配置文件httpd.conf,在相应的位置做以下的修改:
·      将ServerAdmin   mailto:linux@linuxidc.com         一行改为您的邮箱地址
·      将DocumentRoot "/usr/local/apache2/htdocs"      此处为html文件主目录
·      将Options Indexes FollowSymLinks MultiViews 中的"Indexes"去掉,Indexes是为了列出访问地址下所有的文件,包括Html、JSP、PHP、CSS、Image等等。
·      设置apache的默认文件名次序,DirectoryIndex  index.php index.htm default.php default.phtml default.php3 default.html default.htm
·      在Addtype中加入这两句:
 AddType application/x-httpd-php .php  .php3
 AddType application/x-httpd-php-source .phps
重启apache即可。
5、测试 PHP
编写 info.php文件,内容如下:
            <?php  phpinfo();  ?>      //显示PHP的所有信息
将其存放在刚才设置的apache的文档路径下,在浏览器中输入: http://127.0.0.1/info.php,即可看到php 的配置信息。如果报错,请先查看该文件的权限设置,如果不行则查看日志。
6、 设置 APACHE 的开机自动启动 :
# cd /etc/rc.d/init.d
# ln -s /usr/local/apache/bin/apachectl httpd
# chmod 700 httpd
# vi httpd
   键入"i"进入插入状态,把文件头的部分的chkconfig 和 description修改成如下所示:
# chkconfig: 2345 10 90
# description: Activates/Deactivates Apache Web Server
  键入":"进入命令行状态,输入"wq"(存盘退出命令)。
  最后,运行chkconfig把Apache添加到系统的启动服务组里面。
# /sbin/chkconfig --del httpd
# /sbin/chkconfig --add httpd
注:在 Linux 下安装 PHP或者执行开启Apache程序时可能会发生如下错误
         cannot restore segment prot after reloc: Permission deni ed
该问题是由于 SELinux 的权限控制,解决办法有两个
1、  使用 chcon 命令
chcon -t   texrel_shlib_t 文件的地址
 
示例 : chcon -t texrel_shlib_t /usr/local/rsi/idl_6.1/bin/bin.linux.x86/*.so
2 禁止掉 SELinux
更改 /etc/sysconfig/selinux 文件的内容为 SELINUX=disabled     // 好象没有成功。
关于 SELinux 具体情况可能参考:
  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值