|
 |
栏目导栏 |
|
| |
|
|
|
|
 |
资料搜索 |
|
| |
|
|
|
|
 |
热门文章 |
|
| |
|
|
|
|
 |
最新文章 |
|
| |
|
|
|
| |
| |
|
|
|
| |
| FC5+Apache2+PHP5+MYSQL5环境配置 |
|
[ 作者: 加入时间:2006-07-20 12:52:35 来自:
] | |
|
准备工作: YHnLinux联盟 httpd-2.2.2.tar.gz YHnLinux联盟 下载:http://httpd.apache.org/download.cgi YHnLinux联盟 YHnLinux联盟 php-5.1.4.tar.gz YHnLinux联盟 下载:http://www.php.net/downloads.php YHnLinux联盟 YHnLinux联盟 mysql-standard-5.0.21-linux-i686-glibc23.tar.gz YHnLinux联盟 下载:http://dev.mysql.com/downloads/mysql/5.0.html YHnLinux联盟 YHnLinux联盟 一、先安装mysql5 YHnLinux联盟
| 代码: | YHnLinux联盟 1以下使用root身份 YHnLinux联盟 添加用户组和用户,mysql服务需要以mysql组的用户来执行 YHnLinux联盟 shell> groupadd mysql YHnLinux联盟 shell> useradd -g mysql mysql YHnLinux联盟 YHnLinux联盟 2释放压缩文件到/usr/local下 YHnLinux联盟 把压缩包放到/usr/local下 YHnLinux联盟 shell> cd /usr/local YHnLinux联盟 shell> tar zxvf mysql-standard-5.0.21-linux-i686-glibc23.tar.gz YHnLinux联盟 然后得到 一个文件夹mysql-standard-5.0.21-linux-i686-glibc23 YHnLinux联盟 YHnLinux联盟 3给这个巨长文件名的文件夹作个快捷方式,这样以后不用打那么长字了,呵呵 YHnLinux联盟 shell> ln -s mysql-standard-5.0.21-linux-i686-glibc23 mysql YHnLinux联盟 YHnLinux联盟 4创建授权表 YHnLinux联盟 shell> cd /usr/local/mysql YHnLinux联盟 shell> scripts/mysql_install_db --user=mysql YHnLinux联盟 YHnLinux联盟 5更改许可权限 YHnLinux联盟 shell> cd /usr/local/mysql YHnLinux联盟 shell> chown -R root . YHnLinux联盟 shell> chown -R mysql data YHnLinux联盟 shell> chgrp -R mysql . YHnLinux联盟 YHnLinux联盟 6启动mysql并且测试 YHnLinux联盟 shell> bin/mysqld_safe --user=mysql & YHnLinux联盟 如果没有报错就是启动成功了 YHnLinux联盟 shell> bin/mysql YHnLinux联盟 如果出现 YHnLinux联盟 Welcome to the MySQL monitor. Commands end with ; or \g. YHnLinux联盟 Your MySQL connection id is 5 to server version: 5.0.21-standard YHnLinux联盟 YHnLinux联盟 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. YHnLinux联盟 YHnLinux联盟 mysql> YHnLinux联盟 说明成功了 YHnLinux联盟
| YHnLinux联盟 YHnLinux联盟 YHnLinux联盟 YHnLinux联盟 二、安装Apache2 YHnLinux联盟
| 代码: | YHnLinux联盟 因为PHP是安装在apache之上的,所以在安装PHP之前要现装APACHE,而MYSQL是什么时候安装都可以。 YHnLinux联盟 1解压缩 YHnLinux联盟 shell> tar zxvf httpd-2.2.2.tar.gz YHnLinux联盟 shell> cd httpd-2.2.2 YHnLinux联盟 YHnLinux联盟 2配置安装 YHnLinux联盟 shell> ./configure --prefix=/usr/local/apache2 --enable-module=so --enable-module=rewrite --enable-shared=max YHnLinux联盟 没有出现错误就 继续下一步 YHnLinux联盟 YHnLinux联盟 3编译安装 YHnLinux联盟 shell> make YHnLinux联盟 没有出现错误就 继续下一步 YHnLinux联盟 shell> make install YHnLinux联盟 没有出现错误就 继续下一步 YHnLinux联盟 YHnLinux联盟 4安装完成,测试 YHnLinux联盟 进入/usr/local/apache2(地2布指定的安装路径) YHnLinux联盟 vim htdocs/index.html YHnLinux联盟 随便写点东西 YHnLinux联盟 执行bin/apachectl start & YHnLinux联盟 如果启动成功 YHnLinux联盟 打开浏览器浏览 http://127.0.0.1 YHnLinux联盟 如果看到你刚才些的东西,那么你的APACHE2安装成功了 YHnLinux联盟
| YHnLinux联盟 YHnLinux联盟 YHnLinux联盟 YHnLinux联盟 三、安装PHP5 YHnLinux联盟
| 代码: | YHnLinux联盟 1解压缩 YHnLinux联盟 shell> tar zxvf php-5.1.4.tar.gz YHnLinux联盟 shell> cd php-5.1.4 YHnLinux联盟 YHnLinux联盟 2配置安装 YHnLinux联盟 shell> ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --enable-force-cgi-redirect --with-freetype-dir=/usr --with-png-dir=/usr --with-gd --enable-gd-native-ttf --with-ttf --with-gdbm --with-gettext --with-iconv --with-jpeg-dir=/usr --with-png --with-zlib --with-xml --enable-calendar YHnLinux联盟 注意:以上参数可能根据情况不同而改变,如果报错,请自己修改,如果你不想开启某些功能,也可以删除一些参数,影响不会很大 YHnLinux联盟 YHnLinux联盟 3编译安装 YHnLinux联盟 shell> make YHnLinux联盟 shell> make install YHnLinux联盟 YHnLinux联盟 4设置PHP配置文件php.ini YHnLinux联盟 在压缩包里有个php.ini文件,把他拷贝到/usr/local/lib/php.ini YHnLinux联盟 这里路径可以改变,你可以在上面的“2配置安装”一步中加上参数:--with-config-file-path=/some/path 就可以了 YHnLinux联盟 然后打开文件,修改register_globals值为 register_globals = On YHnLinux联盟 YHnLinux联盟 5编辑APACHE2配置文件 YHnLinux联盟 使得APACHE2能够启动PHP模块: YHnLinux联盟 APACHE2的配置文件应该在/usr/local/apache2/conf/httpd.conf YHnLinux联盟 打开他,在最下面加入LoadModule php5_module modules/libphp5.so YHnLinux联盟 注意:如果上面已经有了 就不用加了 YHnLinux联盟 YHnLinux联盟 使得APACHE2能对以.php结尾的地址进行识别 YHnLinux联盟 加入AddType application/x-httpd-php .php YHnLinux联盟 YHnLinux联盟 OK现在安装结束 YHnLinux联盟 YHnLinux联盟 6测试 YHnLinux联盟 vim /usr/local/apache2/htdocs/index.php YHnLinux联盟 写入 YHnLinux联盟 <? YHnLinux联盟 phpinfo(); YHnLinux联盟 ?> YHnLinux联盟 启动APACHE2 YHnLinux联盟 浏览器浏览http://127.0.0.1/index.php YHnLinux联盟 如果出现PHP信息,就说明OK了 YHnLinux联盟 哈哈 YHnLinux联盟
| YHnLinux联盟
Linux联盟收集整理 ,转贴请标明原始链接,如有任何疑问欢迎来本站Linux论坛讨论 |
|
|
|
|
|