Apache 2.0.50,+php5.1.2+mysql 5.1 安装手记


环境:vmware redhat 9

一般安装步骤是:mysql,apache,php

1.mysql install

//下载安装包并解压缩
tar zxvf mysql*
cd mysql*
//添加用户
# groupadd mysql
# useradd -g mysql mysql
//开始编译
#./configure --prefix=/usr/local/mysql
#cp my-medium.cnf /etc/my.cnf
#./scripts/mysql_install_db --user=mysql
#chown -R root .
#chown -R mysql data
#chgrp -R mysql .
//启动mysql server在后台运行
#./bin/mysqld_safe --user=mysql &
设置密码
# ./bin/mysqladmin -u root password 'passwd'
//进入mysql
# ./bin/mysql -u root -p


2.install apache2.0.50

检查原先是否有安装,如果要安装新版本,可将原来删除
#rpm -qa httpd
#httpd-2.0.40-21
# rpm -e --nodeps httpd-2.0.40-21
//下载安装包并解压缩
#tar zxvf httpd*
#cd httpd*
#./configure --prefix=/usr/local/apache2 --enable-module=so

把apache和mysql加到启动启动文件中
vi /etc/rc.d/rc.local
/usr/local/apache2/bin/apachectl start
/usr/local/mysql/bin/mysqld_safe --user=mysql &


安装时的问题:
Q:httpd: could not open document config file /usr/local/apache/conf/httpd.conf
A:Try manually starting your server with the -f option pointing to the location of your

httpd.conf.
httpd -f <directory>/httpd.conf.
If that works then you need to change your .rc files to include the -f option.

Q:# ./httpd -f /usr/local/apache2/conf/httpd.conf
./httpd: error while loading shared libraries: libaprutil-0.so.0: cannot open shared object

file: No such file or directory
A: vi /etc/ld.so.conf,增加/usr/local/apache2/lib 或者
# cp libaprutil-0.so.0 /usr/kerberos/lib
或者创建/usr/local/apache/conf目录,ln -s /usr/local/apache2/conf/httpd.conf

/usr/local/apache/conf/httpd.conf
vi /usr/local/apache2/conf/httpd.conf
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
#/usr/local/apache2/bin/apachectl restart


3.php install

下载并解压安装包
#bunzip2 -d php*
#tar xvf php*
#cd php*
#cp php.ini-dist /usr/local/lib/php.ini
#./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql
//编译后不能运行make可能是由于configure出了问题
#make && make install
# vi /usr/local/lib/php.ini
mysql.default_port = 3306
mysql.default_host = localhost
mysql.default_user = root
//启动apache
#/usr/local/apache2/bin/apachectl start


测试php:
vi /usr/loacl/apache2/conf/httpd.conf
默认把php文件放在/var/www下
更改DocumentRoot "/var/www"
<Diecrtory "/var/www">


安装时碰到的问题:
Q:configure: error: Cannot find MySQL header files under yes.
A:编译的时候指定mysql的路径 /usr/local/mysql
//重新编译
#make clean
#./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql

Q:# ./apachectl start
Syntax error on line 1070 of /usr/local/apache2/conf/httpd.conf:
Cannot load /usr/local/apache2/modules/libphp5.so into server:

/usr/local/apache2/modules/libphp5.so: undefined symbol: sqlite3SelectDelete
A:# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs

--with-mysql=/usr/local/mysql --with-zlib

Q:# /usr/local/apache2/bin/apachectl restart
Syntax error on line 1051 of /usr/local/apache/conf/httpd.conf:
Cannot load /usr/local/apache2/libexec/libphp5.so into server:

/usr/local/apache2/libexec/libphp5.so: cannot open shared object file: No such file or

directory
A:可以先查找系统是否有libphp5.so,如果没有则重新编译php


4.phpmyadmin install

4.install apache 2.0.55
# ./configure --prefix=/usr/local/apache2
#make && make install
#/usr/local/apache2/bin/apachectl start


5.phpmyadmin 2.8.0.2 install
#tar xvf php*
#cd php*
#mv php* /var/www/phpmyadmin
#cd /var/www/phpmyadmin
#cp ./libraries/config.default.php ./config.inc.php
#vi config.inc.php
$cfg['PmaAbsoluteUri']='http://localhost/phpmyadmin'
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['passwd'] = 'root passwd'

测试phpmyadmin:

http://localhost/phpmyadmin
测试PHP

#vi /var/www/test.php

<?phpinfo();?>

http://localhost/test.php

测试APACHE

http://localhost

aliyun活动 https://www.aliyun.com/acts/limit-buy?userCode=re2o7acl
原文地址:https://www.cnblogs.com/wangbin/p/1509697.html