在Linux下构建电子商务平台
时间:2007-02-17 来源:PHP爱好者
在Linux下构建电子商务平台
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
关键词:PHP, MySQL, LINUX
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
Internet的迅速发展,许多企业都正在构建自己的电子商务平台,而以住的电子商务平台大都是基于NT+IIS+SQL SERVER下的这种构建方式。随着LINUX的崛起,各信息服务商和企业均将自己的电子商务平台转移到LINUX,本文提出了基于在LINUX系统下构建电子商务平台的其中一种方案。
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
解决方案:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
Apache_1.3.12+php-4.0RC1+mysql-3.22.32+phpMyadmin_2.0.5
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
安装环境:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
Linux(Red Hat)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
所需软件:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
1. Apache_1.3.12.tar.gz-----web服务器,类似于IIS
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
2. php-4.0RC1.tar.gz--------运行于服务器端脚本,类似于ASP
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
3. mysql-3.22.32.tar.gz-----UNIX下的数据库系统
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
4. phpMyadmin_2.0.5.tar.gz—mysql的图形管理工具
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
上述软件下载处:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
1. http://www.apache.org/dist/apache_1.3.12.tar.gz(http://www.apache.org/dist/apache_1.3.12.tar.gz)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
2. http://www.php.net/version4/downloads/php-4.0RC1.tar.gz(http://www.php.net/version4/downloads/php-4.0RC1.tar.gz)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
3. http://www.mysql.com/Downloads/MySQL-3.22/mysql-3.22.32.tar.gz(http://www.mysql.com/Downloads/MySQL-3.22/mysql-3.22.32.tar.gz)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
4. http://www.phpwizard.net/phpMyAdmin/phpMyAdmin_2.0.5.tar.gz(http://www.phpwizard.net/phpMyAdmin/phpMyAdmin_2.0.5.tar.gz)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
安装顺序为:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
a) 安装mysql,phpMyAdmin
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
b) 配置Apache编译
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
c) 安装PHP
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
d) 安装Apache
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
e) 配置PHP、Apache、PhpMyAdmin
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
f) 启动Apache
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
1. 登录LINUX,在自己的工作目录下建立一目录soft,用来存放以上下载的各软件的源程序:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ mkdir $HOME/soft
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
2. 建立各项软件的安装目录:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$mkdir $HOME/php $HOME/apache $HOME/mysql
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
php---------安装php-4.0RC1的目录
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
apache----安装Apache_1.3.12服务器的目录
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
mysql-----安装mysql-3.22.32及phpMyAdmin_2.0.5的目录
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
3. 安装mysql及phpMyAdmin
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/soft
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ tar –zxvf phpMyAdmin-2.0.5.tar.gz
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ tar –zxvf mysql-3.22.32.tar.gz
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd mysql-3.23.22(为解压后自动生成的目录)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./configure –prefix=$HOME/mysql
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ make
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ make install
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/mysql/bin
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./mysql_install_db
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./$HOME/mysql/libexec/mysqld & (在后台运行MySQL)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./$HOME/mysql/bin/mysqlshow(显示MySql的运行状态)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
4. 预编译Apache
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ killall httpd(停止所有的HTTP服务)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/soft
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ tar –zxvf apche_1.3.12.tar.gz
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd apache_1.3.12(为解压后自动生成的目录)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./configure –-prefix=$HOME/apache
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
5. 安装php-4.0RC1
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/soft
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ tar –zxvf php-4.0RC1.tra.gz
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd php-4.0RC1(为解压后自动生成的目录)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./configure --with–mysql=$HOME/mysql --with–apache=$HOME/soft/apache_1.3.12 --enable-track-vars --with–charset=gb2312
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
(//因apache还未安装,所以有$HOME/soft/apache_1.3.12
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
//enable-track-vars-----Enable GET/POST/Cookie track variables by default.)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
(如果你还有什么别的PHP模块,也要先编译好了,再在这里加上去)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ make
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ make install
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
6. 安装Apache_1.3.12
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/soft/apache_1.3.12
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./configure --prefix=$HOME/apache --activate–module=src/modules/php4/libphp4.a
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ make
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ make install
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
注意,libphp4.a这个文件会自动生成。另外,所有的命令行要在一行输入,如果你的telnet 终端一行限制80 的话你要用结束在另外起行,这个很重要
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
7. 配置Apache_1.3.12
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$cd $HOME/apache/conf
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ vi httpd.conf(httpd.conf为apache的配置文件)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
找到AddType application/x-httpd-php .php并将此行最前的#号除掉(注意.php前的空格)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
找到ServerName http://。。。。。。。 并去掉注释
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
修改Listen XXX.XXX.XXX:8080(其中xxx.xxx.xxx为域名,或者IP地址)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
修改Port: 8080 (如果是小于1023的话,要root用户才能够启动httpd
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
找到AddType application/x-httpd-php3 .php3并去掉注释(针对PHP3)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
找到AddType application/x-httpd-php3-source .phps并去掉注释
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
加入:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
AddType application/x-httpd-php .php3(注意.php3之前的空格)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
8. 配置mysql(这一步骤可跳过)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/myql/bin
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./mysql .default_port = 3306(注意.default之前的空格)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./mysql .default_host = localhost
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./mysql .default_user = root
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
9. 配置phpMyAdmin_2.0.5
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/soft
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd phpMyAdmin (为第3步解压后自动生成的目录)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ vi config.inc.php3(为其配置文件)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
修改如下一行(另外可根据需要更改文件中其它选项)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
require("english.inc.php3");为 require("chinese_gb.inc.php3");
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
10. 启动Apache
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/apache/bin
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
./apachectl start
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
11. 测试php及phpMyAdmin(也可测试mysql):
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
a).对mysql进行测试:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
在$HOME/apache/conf/httpd.conf中作如下配置:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/apache/conf/
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ vi httpd.conf
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
添加如下一行:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
Alias /soft/ /zcyuan/soft/phpMyAdmin(zcyuan为用户登录LINUX的帐号)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
在浏览器中打开http://yourdoman:port/soft/index.php3 这时该能连接到MYSQL的数据库中,你可以对数所库进行操作。这表明整个系统以能正常工作。
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
说明: 其中yourdomain为你的机器名,port为你在$HOME/apache/conf/httpd.con中设置的端
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
口,下同;
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
b).对PHP进行测试:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
在$HOME/apache/htdoc/(APACHE服务安装的目录)下新建立一个php文件如下:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
文件名 info.php
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
//查看系统状况 文件开始
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
//文件结束
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
在浏览器中访问此页时你将得到有关PHP的运行资料.
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
http://yourdomain:port/info.php(http://yourdomain:port/info.php)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
利用如上安装方法可建立基于LINUX系统下的电子商务平台,而且它所占系统资源较少,对于大用户量的访问,运行很稳定,尤其适合中小型企业。
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
非常全面的一个php技术网站,php 爱好者站 http://www.phpfans.net 有相当丰富的文章和源代码.
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
关键词:PHP, MySQL, LINUX
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
Internet的迅速发展,许多企业都正在构建自己的电子商务平台,而以住的电子商务平台大都是基于NT+IIS+SQL SERVER下的这种构建方式。随着LINUX的崛起,各信息服务商和企业均将自己的电子商务平台转移到LINUX,本文提出了基于在LINUX系统下构建电子商务平台的其中一种方案。
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
解决方案:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
Apache_1.3.12+php-4.0RC1+mysql-3.22.32+phpMyadmin_2.0.5
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
安装环境:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
Linux(Red Hat)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
所需软件:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
1. Apache_1.3.12.tar.gz-----web服务器,类似于IIS
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
2. php-4.0RC1.tar.gz--------运行于服务器端脚本,类似于ASP
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
3. mysql-3.22.32.tar.gz-----UNIX下的数据库系统
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
4. phpMyadmin_2.0.5.tar.gz—mysql的图形管理工具
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
上述软件下载处:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
1. http://www.apache.org/dist/apache_1.3.12.tar.gz(http://www.apache.org/dist/apache_1.3.12.tar.gz)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
2. http://www.php.net/version4/downloads/php-4.0RC1.tar.gz(http://www.php.net/version4/downloads/php-4.0RC1.tar.gz)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
3. http://www.mysql.com/Downloads/MySQL-3.22/mysql-3.22.32.tar.gz(http://www.mysql.com/Downloads/MySQL-3.22/mysql-3.22.32.tar.gz)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
4. http://www.phpwizard.net/phpMyAdmin/phpMyAdmin_2.0.5.tar.gz(http://www.phpwizard.net/phpMyAdmin/phpMyAdmin_2.0.5.tar.gz)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
安装顺序为:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
a) 安装mysql,phpMyAdmin
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
b) 配置Apache编译
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
c) 安装PHP
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
d) 安装Apache
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
e) 配置PHP、Apache、PhpMyAdmin
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
f) 启动Apache
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
1. 登录LINUX,在自己的工作目录下建立一目录soft,用来存放以上下载的各软件的源程序:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ mkdir $HOME/soft
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
2. 建立各项软件的安装目录:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$mkdir $HOME/php $HOME/apache $HOME/mysql
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
php---------安装php-4.0RC1的目录
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
apache----安装Apache_1.3.12服务器的目录
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
mysql-----安装mysql-3.22.32及phpMyAdmin_2.0.5的目录
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
3. 安装mysql及phpMyAdmin
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/soft
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ tar –zxvf phpMyAdmin-2.0.5.tar.gz
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ tar –zxvf mysql-3.22.32.tar.gz
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd mysql-3.23.22(为解压后自动生成的目录)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./configure –prefix=$HOME/mysql
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ make
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ make install
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/mysql/bin
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./mysql_install_db
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./$HOME/mysql/libexec/mysqld & (在后台运行MySQL)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./$HOME/mysql/bin/mysqlshow(显示MySql的运行状态)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
4. 预编译Apache
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ killall httpd(停止所有的HTTP服务)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/soft
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ tar –zxvf apche_1.3.12.tar.gz
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd apache_1.3.12(为解压后自动生成的目录)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./configure –-prefix=$HOME/apache
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
5. 安装php-4.0RC1
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/soft
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ tar –zxvf php-4.0RC1.tra.gz
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd php-4.0RC1(为解压后自动生成的目录)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./configure --with–mysql=$HOME/mysql --with–apache=$HOME/soft/apache_1.3.12 --enable-track-vars --with–charset=gb2312
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
(//因apache还未安装,所以有$HOME/soft/apache_1.3.12
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
//enable-track-vars-----Enable GET/POST/Cookie track variables by default.)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
(如果你还有什么别的PHP模块,也要先编译好了,再在这里加上去)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ make
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ make install
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
6. 安装Apache_1.3.12
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/soft/apache_1.3.12
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./configure --prefix=$HOME/apache --activate–module=src/modules/php4/libphp4.a
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ make
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ make install
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
注意,libphp4.a这个文件会自动生成。另外,所有的命令行要在一行输入,如果你的telnet 终端一行限制80 的话你要用结束在另外起行,这个很重要
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
7. 配置Apache_1.3.12
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$cd $HOME/apache/conf
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ vi httpd.conf(httpd.conf为apache的配置文件)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
找到AddType application/x-httpd-php .php并将此行最前的#号除掉(注意.php前的空格)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
找到ServerName http://。。。。。。。 并去掉注释
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
修改Listen XXX.XXX.XXX:8080(其中xxx.xxx.xxx为域名,或者IP地址)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
修改Port: 8080 (如果是小于1023的话,要root用户才能够启动httpd
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
找到AddType application/x-httpd-php3 .php3并去掉注释(针对PHP3)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
找到AddType application/x-httpd-php3-source .phps并去掉注释
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
加入:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
AddType application/x-httpd-php .php3(注意.php3之前的空格)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
8. 配置mysql(这一步骤可跳过)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/myql/bin
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./mysql .default_port = 3306(注意.default之前的空格)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./mysql .default_host = localhost
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ ./mysql .default_user = root
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
9. 配置phpMyAdmin_2.0.5
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/soft
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd phpMyAdmin (为第3步解压后自动生成的目录)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ vi config.inc.php3(为其配置文件)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
修改如下一行(另外可根据需要更改文件中其它选项)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
require("english.inc.php3");为 require("chinese_gb.inc.php3");
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
10. 启动Apache
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/apache/bin
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
./apachectl start
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
11. 测试php及phpMyAdmin(也可测试mysql):
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
a).对mysql进行测试:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
在$HOME/apache/conf/httpd.conf中作如下配置:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ cd $HOME/apache/conf/
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
$ vi httpd.conf
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
添加如下一行:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
Alias /soft/ /zcyuan/soft/phpMyAdmin(zcyuan为用户登录LINUX的帐号)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
在浏览器中打开http://yourdoman:port/soft/index.php3 这时该能连接到MYSQL的数据库中,你可以对数所库进行操作。这表明整个系统以能正常工作。
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
说明: 其中yourdomain为你的机器名,port为你在$HOME/apache/conf/httpd.con中设置的端
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
口,下同;
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
b).对PHP进行测试:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
在$HOME/apache/htdoc/(APACHE服务安装的目录)下新建立一个php文件如下:
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
文件名 info.php
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
//查看系统状况 文件开始
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
//文件结束
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
在浏览器中访问此页时你将得到有关PHP的运行资料.
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
http://yourdomain:port/info.php(http://yourdomain:port/info.php)
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
利用如上安装方法可建立基于LINUX系统下的电子商务平台,而且它所占系统资源较少,对于大用户量的访问,运行很稳定,尤其适合中小型企业。
chi na it p owe r .comqyH1bcrzy6sgppzkgQ52Br5QC
非常全面的一个php技术网站,php 爱好者站 http://www.phpfans.net 有相当丰富的文章和源代码.
相关阅读 更多 +