发布时间:2022-08-09 文章分类:编程知识 投稿人:赵颖 字号: 默认 | | 超大 打印



通过rpm -ivh 命令安装下面几个mysql rpm包

Java代码
  1. MySQL-client-5.5.9-1.rhel5.x86_64.rpm//安装客户端rhel5.x86_64:redhatenterpriseLinuxx8664bit
  2. MySQL-server-5.5.9-1.rhel5.x86_64.rpm//安装服务端
  3. MySQL-devel-5.5.9-1.rhel5.x86_64.rpm//安装devel包,不然在接下来安装php时会抛找不到mysql.h文件安装好后find/-namemysql.h-print查看mysql.h在哪
  4. MySQL-shared-5.5.9-1.rhel5.x86_64.rpm//安装shared包,不然在接下来安装php时会抛找不到libmysqlclient.so.1.6.0.0文件,如果还找不到,可以使用find/-namelibmysqlclient*-print查看在文件在哪,然后再软连接一下
MySQL-client-5.5.9-1.rhel5.x86_64.rpm //安装客户端    rhel5.x86_64: redhat enterprise Linux  x86 64bit
MySQL-server-5.5.9-1.rhel5.x86_64.rpm  //安装服务端
MySQL-devel-5.5.9-1.rhel5.x86_64.rpm   //安装devel包,不然在接下来安装php时会抛找不到mysql.h文件 安装好后find / -name mysql.h -print 查看mysql.h在哪
MySQL-shared-5.5.9-1.rhel5.x86_64.rpm   //安装shared包,不然在接下来安装php时会抛找不到libmysqlclient.so.1.6.0.0文件 ,如果还找不到,可以使用find / -name libmysqlclient* -print 查看在文件在哪,然后再软连接一下
Java代码
  1. eg:rpm-ivhMySQL-client-5.5.9-1.rhel5.x86_64.rpm
eg:rpm -ivh MySQL-client-5.5.9-1.rhel5.x86_64.rpm

通过rpm安装,经常遇到依赖问题,可采取依赖什么补装什么,是不是直接编译安装会更简便些,虽然编译起来耗时比较久。

安装Apahce

Java代码
  1. tar-zxvfhttpd-2.2.17.tar.gz
  2. mvhttpd-2.2.17apache
  3. cdapache
  4. ./configure--prefix=/home/tongweb/httpd-2.2.17--enable-module=so
  5. make
  6. makeinstall
tar -zxvf httpd-2.2.17.tar.gz
 mv httpd-2.2.17 apache
 cd apache
 ./configure --prefix=/home/tongweb/httpd-2.2.17 --enable-module=so
 make
 make install

编辑http.conf文件

Java代码
  1. <IfModulemime_module>
  2. ...
  3. AddTypeapplication/x-httpd-php.php.phtml.php3.php4.php5.inc//addthisline
  4. AddTypeapplication/x-httpd-php-source.phps//addthisline
  5. ...
  6. </IfModulemime_module>
<IfModule mime_module>
...
AddType application/x-httpd-php .php .phtml .php3 .php4 .php5 .inc //add this line
AddType application/x-httpd-php-source .phps //add this line
...
</IfModule mime_module>

检查是否有:

Java代码
  1. LoadModulephp5_modulemodules/libphp5.so
LoadModule php5_module   modules/libphp5.so

安装PHP

Java代码
  1. tarzxvfphp-5.3.5.tar.gz//解压
  2. ./configure--prefix=/home/tongweb/php5--with-apxs2=/home/tongweb/apache-2.2.17/bin/apxs--with-mysql=/usr//配置(通过--prefix指定php安装路径、通过--with-apxs2指向apache的apxs文件的路径、通过with-mysql指向mysql的basedir[这里可以通过mysql的命令来查看:showvariableslike'%base%'])
  3. make//编译
  4. makeinstall//安装
  5. cp/home/tongweb/php-5.3.5/php.ini-development/home/tongweb/php5/lib/php.ini//将php.ini-development复制至/home/tongweb/php5/lib下并命名为php.ini
  6. viphp.ini
  7. session.gc_maxlifetime=3600//modifythisline
  8. max_execution_time=120////modifythisline
  9. date.timezone='Asia/Shanghai'////modifythisline
tar zxvf php-5.3.5.tar.gz  // 解压
./configure --prefix=/home/tongweb/php5 --with-apxs2=/home/tongweb/apache-2.2.17/bin/apxs --with-mysql=/usr  //配置 (通过--prefix指定php安装路径、通过--with-apxs2指向apache的apxs文件的路径、通过with-mysql指向mysql的basedir[这里可以通过mysql的命令来查看:show variables like '%base%'])
make //编译
make install //安装
cp /home/tongweb/php-5.3.5/php.ini-development /home/tongweb/php5/lib/php.ini //将php.ini-development复制至/home/tongweb/php5/lib下并命名为php.ini
vi php.ini
session.gc_maxlifetime = 3600 // modify this line
max_execution_time = 120 //// modify this line
date.timezone = 'Asia/Shanghai'//// modify this line

可以通过写个如下info.php查看php的一些信息: