天天看点

RHEL5下Mysql-5.0.87+apache-2.2.14+php-5.2.11的安装笔记

RHEL5下Mysql-5.0.87+apache-2.2.14+php-5.2.11的安装笔记

但只是把mysql apache php的 版本升级为最新,尝试安装,

并不是在已有的基础上分别进行软件包的升级,而是全新的安装,

差别就是现在的版本较高

我的安装顺序还是 先安装mysql 在安装apache 在安装php 最后进行简单的测试

关于mysql 5.0.87的安装

参考

<a href="http://yuzeying.blog.51cto.com/644976/229224">http://yuzeying.blog.51cto.com/644976/229224</a>

在此不再详细说明了

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073818mCii.jpg"></a>

以上是 操作系统的相关情况

[root@localhost ~]# cd /usr/local/src

下载apache

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073820EYfi.jpg"></a>

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073822f8dZ.jpg"></a>

下面开始安装apache

[root@localhost src]# tar -zxvf httpd-2.2.14.tar.gz

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073825GJIE.jpg"></a>

[root@localhost src]# cd httpd-2.2.14

[root@localhost httpd-2.2.14]# ./configure --prefix=/usr/local/apache --enable-module=so

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073826kjy7.jpg"></a>

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073828kxIF.jpg"></a>

执行命令 make &amp;&amp; make install

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073830uNsA.jpg"></a>

[root@localhost httpd-2.2.14]# /usr/local/apache/bin/apachectl start

启动apache

[root@localhost httpd-2.2.14]# netstat -tnl

查看端口,看看80起来没

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073832Ekea.jpg"></a>

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073834iayA.jpg"></a>

解压php

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073837nsfc.jpg"></a>

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073841hLxC.jpg"></a>

进入安装目录

[root@localhost php-5.2.11]# ./configure \

&amp;gt; --prefix=/usr/local/php \

&amp;gt; --with-mysql=/usr/local/mysql \

&amp;gt; --with-apxs2=/usr/local/apache/bin/apxs

这里只是做个最基本的安装而已

指定一下路径

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073845nxpS.jpg"></a>

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_12590738478nGd.jpg"></a>

执行命令,make &amp;&amp; make install

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073850yS7a.jpg"></a>

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073856KF5E.jpg"></a>

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_12590738584Xz9.jpg"></a>

虽然装完了,但是貌似有一大堆的错误

我们暂且拷贝一下配置文件,然后写个简单的测试页,看行不行

[root@localhost php-5.2.11]# cp php.ini-dist /usr/local/lib/php.ini

复制配置文件

修改apache配置文件 使其能够识别.PHP结尾的网页文件

[root@localhost php-5.2.11]# vi /usr/local/apache/conf/httpd.conf

AddType application/x-httpd-php .php

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073860u6rf.jpg"></a>

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073861OSym.jpg"></a>

[root@localhost ~]# /usr/local/mysql/bin/mysqladmin -u root password 123

[root@localhost ~]# /usr/local/mysql/bin/mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.0.87-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql&amp;gt; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123' WITH GRANT OPTION;

Query OK, 0 rows affected (0.02 sec)

mysql&amp;gt;

赋予root用户登录数据库密码,并赋予远程密码

写一个测试脚本

[root@localhost php-5.2.11]# vi /usr/local/apache/htdocs/index.php

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073864fd6R.jpg"></a>

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073865Sgn4.jpg"></a>

很奇怪的是虽然有错误,但还是可以正常运行

改一下测试页试试

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073867Te0o.jpg"></a>

&lt;?

echo "hello world !!";

mysql_connect ("192.168.1.14","root","123");

mysql_query ("create database test1;");

?&gt;

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073868oz9l.jpg"></a>

<a href="http://yuzeying.blog.51cto.com/attachment/200911/24/644976_1259073870kpJ8.jpg"></a>

登录数据库,看看是不是有test1 数据库

Ok,到此为止,php可以正常运行 并且可以连接数据库

关于

Warning: Cannot use a scalar value as an array in phar://install-pear-nozlib.phar/PEAR/ChannelFile.php on line 1391

Warning: Cannot use a scalar value as an array in phar://install-pear-nozlib.phar/PEAR/ChannelFile.php on line 1396错误

网上说这是一个

Pear broken in php 5.2.11

<b></b>

<b>http://bugs.php.net/bug.php?id=49682</b>

<b>解决方法</b>

[root@localhost php-5.2.11]# rm -rf /usr/local/php/lib/php/.channels

[root@localhost php-5.2.11]# /usr/local/php/bin/pecl update-channels

本文转自 yuzeying1 51CTO博客,原文链接:http://blog.51cto.com/yuzeying/234140