一、安装mysql
1.tar zxvf mysql-5.1.34.tar.gz
2.cd mysql-5.1.34
3.groupadd mysql
useradd -g mysql mysql
4../configure --prefix=/usr/local/mysql
make
make install
5../scripts/mysql_install_db --user=mysql
6.cp support-files/my-medium.cnf /etc/my.cnf
7.cd /usr/local/mysql(以下操作都在/usr/local/mysql下进行)
chown -R root .
chown -R mysql var
chown -R mysql .
8.bin/mysqld_safe --user=mysql
出现错误:
090607 07:27:20 mysqld_safe Logging to '/usr/local/mysql/var/suse10.err'.
090607 07:27:20 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
090607 07:27:20 mysqld_safe mysqld from pid file /usr/local/mysql/var/suse10.pid ended
cat /usr/local/mysql/suse10.err发现:
090607 07:27:20 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
090607 7:27:20 [ERROR] /usr/local/mysql/libexec/mysqld: unknown option '--skip-federated'
090607 7:27:20 [ERROR] Aborting
090607 7:27:20 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete
090607 07:27:20 mysqld_safe mysqld from pid file /usr/local/mysql/var/suse10.pid ended
解决方法:
将/etc/my.cnf中的 skip-federated注释掉即可:
vi /etc/my.cnf
# skip-federated
重新bin/mysqld_safe --user=mysql 出现:
090607 07:34:08 mysqld_safe Logging to '/usr/local/mysql/var/suse10.err'.
090607 07:34:08 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
说明mysql进程启动成功
9.echo "export PATH=$PATH:/usr/local/mysql/bin" >> "/root/.bashrc"
source /root/.bashrc(配置环境变量)
10.修改mysql的密码(以root登陆):
cd /usr/local/mysql/bin
./mysqladmin -u root password yourpassword
11.进入mysql进行测试
mysql -u root -p
输入密码,出现
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.34-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
说明mysql已经安装成功,可以使用了
二、安装libxml2
1.bunzip2 libxml2-2.6.23.tar.bz2
tar xf libxml2-2.6.23.tar
2.cd libxml2-2.6.23
./configure --prefix=/usr/local/libxml2
make
make install
三、安装apache
1.tar zxvf httpd-2.2.11.tar.gz
2.cd httpd-2.2.11
./configure --prefix=/usr/local/apache --enable-module=so
make
make install
四、安装php
1. tar zxvf php-5.2.9.tar.gz
2. cd php-5.2.9/
./configure --with-libxml2=/usr/local/libxml2 --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql
出现错误:
Configuring extensions
checking whether to enable LIBXML support... yes
checking libxml2 install dir... no
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
汗!我记得第二步装的就是libxm2啊,搜了一下,才发现没有装libxml2-devel包,libxml2与libxml2-devel,前者是程序运行时需要的库,叫运行库,后者是编译源码时需要的库,叫开发库,没办法,下吧:
找了最新的libxml2-devel-2.7.3-1.x86_64.rpm进行安装:
rpm -ivh libxml2-devel-2.7.3-1.x86_64.rpm 出现:
warning: libxml2-devel-2.7.3-1.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID de95bc1f
error: Failed dependencies:
libxml2 = 2.7.3-1 is needed by libxml2-devel-2.7.3-1.x86_64
libxml2.so.2()(64bit) is needed by libxml2-devel-2.7.3-1.x86_64
晕了,下载的太新了,只能重新下载跟libxml2-2.6.23相对应的libxml2-devel-2.6.23:
rpm -ivh libxml2-devel-2.6.23-1.i386.rpm 终于安装好了
重新configure:
./configure --with-libxml2=/usr/local/libxml2 --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql
出现:
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
Thank you for using PHP.
Notice: Following unknown configure options were used:
--with-libxml2=/usr/local/libxml2
Check './configure --help' for available options
没的说了,距离成功仅一步之遥。
3.配置php
vi /usr/local/apache/conf/httpd.conf
修改:
DirectoryIndex index.html index.php index.htm index.asp index.jsp index.html
.var
另外在
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz 之后入一行:
AddType application/x-httpd-php .php .php3
五、最终测试
创建一个网页:
vi /usr/local/apache/htdocs/1.php
phpinfo();
?>
启动apache服务:
/usr/local/apache/bin/apachectl start
在浏览器输入http://服务器IP/1.php 最终出现下图:
恭喜你,成功了!!!!
阅读(2852) | 评论(1) | 转发(0) |