Beginning PHP
Windows中PHP5.1与Apache2.2的配置
Apache 的安装与配置
打开apache官方网站apahce,下载里面的apache_2.2.x-win32-x86-no_ssl.msi安装文件,其中同一版本有两种类型,no_ssl 和openssl,openssl多了一个ssl安全认证模式,它的协议是HTTPS而不是HTTP,这就是带有SSL的服务器与一般网面服务器的区别了。下载完毕后,直接点选 next 后,设置目前都可以为默认,安装完毕后,apache就自动启动,我们可以测试apache是否成功启动,在地址栏中输入 http://localhost/ 或http://127.0.0.1,如果出现"It works.",那么恭喜你,apache 已经成功安装了,同时在电脑右下角的任务栏中有一绿色的apache服务器运行图标。
apache还有一个配置文件:httpd.conf需要配置,以使php运行,位置为:c://apache/conf/目录下,打开httpd.conf修改配置如下:
1) 查找"DocumentRoot",这里是指定主页放置的目录,默认是"c:/apache/htdocs",你也可以自行指定。
2) 查找"DirectoryIndex",这里是默认首页文件名,可以在index.html的后面加入index.php等,每种类型之间都要留一个空格。
3) 查找
< Directory/>
Options FollowSymLinks
AllowOverride None
Order deny,allow
< /Directory>
修改成:
< Directory/>
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
< /Directory>
注:如果不修改的话,可能会出现you don't have permission to access/on this server.这样的错误提示,但如果不修改默认的话,可能不用修改。
PHP的安装与配置方法
首先从php的官方网站php 下载windows版本的zip包,下载完成后解压到c:/php目录下,(可自行指定)
1) 把刚下载下来的包解压到c:/php目录下。
2) 将php目录下的php.ini.dist 文件重命名为php.ini,PHP的配置文件就是它,修改为下几个地方,修改好后把php.ini文件复制到c:/windows/目录里:
I extension_dir="c:\php\ext" //指向php文件夹下放置"php_*.dll"文件的路径。
II doc_root="**" //指向apache设置的首页位置。
III default_charset="gb2312" //修改默认字符集,这里前面如有分号";",去掉这个分号,有时默认字符集也可以设置为utf8。
IV register_globals=Off改为register_globals=On //使传递合局变量有效。
V extension=php_dba.dll //如果前面有分号,取消分号,以下同:
extension=php_dbase.dll
extension=php_gd2.dll GD库做图
extension=php_mysql.dll 用于连接MYSQL数据库
3) 将PHP目录下的php5ts.dll文件拷贝到c:\windows\system32目录下。
4) 最后修改Apache的httpd.conf文件,在该文件的尾部添加如下2行:
LoadModule php5_module c:/php/php5apache2_2.dll
AddType application/x-httpd-php .php
注意:第一行的目录路径要更新为当前版本的apache动态链接库,比如这里我使用的是apache2.2.8版本和php5.2.5,那这个文件必须是php5apache2_2.dll,而不能是php5apache.dll,php5apache2.dll等,第二行为php脚步的后缀。
以上就完成了apache和php的配置过程了,重启apache,在服务器的默认目录:c:\apache\htdocs"里新建文件index.php,写上如下代码:
<问号php phpinfo(); 问号>
在浏览器地址栏里输入http://localhost,你就会看到php版本信息,到此为止,php和apache就已经成功的安装了。
What can i design?
- Logo Design and Brand Development: Whether you need to create a new brand or revitalize an existing one, I can help. I can design Logo Design, Identity Development, Brand Style Guides, Custom Illustration, Artwork Vectorization and much more!
- Print Design, Business Collateral Production: I can design Business Systems, Photography, Production Work, business cards, letterhead, brochures, catalogs, mailers and much more!
- Websites Design and Maintenance: I design killer websites for companies of almost every size and shape. I can design WebSite and WebSite Maintenance, E-Commerce, Content Managment and much more!
- Creative Marketing and Logo Promotion: I can do Search Engines optimization, Email Marketing, Printed T-shirts, Logo Apparel, Promotion Gifts and much more!
I am a designer who is easygoing, useful, well-organized, independent, skillful, confidence, and calm under pressure.


