| Ball 的个人资料湛蓝清泉照片日志列表 | 帮助 |
|
2007/8/27 任务 昨天还在短信里和Mr唐说:上班快三周了也没分到具体任务,不知什么时候才能发挥点作用。今儿任务就来了! PS:昨儿吃晚饭后回公司,看到了南拳妈妈的歌友会~北京这地儿想见明星还真容易,附图一张。 2007/8/11 俺的第一个PHP 开始学php了,今儿完成了第一段代码,在XO的帮助下终于跑起来了。记录之~
环境: 10.3.145.79为服务器机,操作系统为Linux,安装了apache和php。 客户机为本人台式机,操作系统为XP。 总体分三步:
1.形成代码 2.配置apache服务器 3.在客户机上访问服务器 下面进行详细说明:
1.形成代码 <html> <head> <title>Example</title> </head> <body> <?php echo "Hi, I'm a PHP script!"; ?> </body> </html> 文件名起为index.php,起这个名字的原因会在下文中解释。 2.配置apache服务器
(1)修改apache的配置文件/usr/local/apache2/conf/httpd.conf 添加如下代码段: <VirtualHost *:80> ServerAdmin root@canon.com DocumentRoot /home/qmhball/web/ Rewriteengine on # RewriteRule ^/news.cgi(.*) /i.q$1 ServerName qmhball.cannon.com DirectoryIndex index.shtml index.html index.php index.php4 index.php5 ErrorLog logs/qmhball.cannon.com-error_log CustomLog logs/qmhball.cannon.com-access_log common <Directory /> Options Includes FollowSymLinks AllowOverride None </Directory> XBitHack on </VirtualHost> 这样做的目的是可以通过域名qmhball.cannon.com域名访问服务器,访问的首页存放在DocumentRoot指定的目录下,这里我选定的是home/qmhball/web/。DirectoryIndex index项指定了可用的首页文件名,这就是前文中我们将php代码的文件名起为index.php的原因。 (2)运行/usr/local/apache2/bin/apachectl graceful(或restart) 使配置生效。 3.在客户机上访问服务器
(1)因为没有DNS解析,所以要修改下C:\WINDOWS\system32\drivers\etc\hosts。加入: 10.3.145.79 qmhball.cannon.com (2)在IE中输入qmhball.cannon.com即可看到网内容:
Hi, I'm a PHP script! O YEAH! |
|
|