PHP安装步骤(以apache 2.2 + php5.3为例)
1. Download Apache for windows MSIfile, and run it Bydefault, port is 80, root dir is %apache_dir%/htdocs. You can update thesettings in conf/httpd.conf file 2. If Apache Service can't be installed in Control Panel Admin Tools Services, Ex
1. Download Apache for windows MSIfile, and run it
Bydefault, port is 80, root dir is %apache_dir%/htdocs. You can update thesettings in conf/httpd.conf file
2. If Apache Service can't be installed in "Control Panel > Admin Tools > Services",
Execute following command in %apache_dir%/bin
httpd.exe -k install -n Apache2.2
另外几个有用的命令:
remove apache service: httpd.exe -k uninstall -n Apache2.2
start apache service from : httpd.exe -k start
stop apache service: httpd.exe -k stop or
httpd.exe -k shutdown
restart apache service: <span>httpd.exe -k restart</span>
如果不通过windows Apache service,你可以直接使用下列命令:
start apache server: httpd
stop apache server: <span>httpd.exe -k shutdown</span>
restart apache server: <span>httpd.exe -k restart</span>
2. Test if apache server works
1) Start server: start “Apacheservice” from “Control Panel > select “Start > Programs > Apache httpserver 2 > control apache server > start” or start server from apacheserver icon in the right bottom corner of desktop
For Win 7,上述方法都无法启动apache server,你需要rightclick右下角的apache icon,然后select “open services”,然后start“apache server” service
2) Try to accesshttp://localhost
3. Download and extract php5.3 zipfile
Note: download php 5.3 VC9 thread safe version
4. 进入 php的安装目录,将php.ini-production或php.ini-development复制一份,命名为 php.ini。
Assume php install dir is “d:/php5”
5. Configure PHP in php.ini file
1) Find
extension_dir = "./"
Change it to following
extension_dir = "d:/php5/ext"
IF there is "#" before above code, MUST REMOVE IT!!!!!!!!!!!!!!
php can’tfind extension module without it
2) To support mysql, remove “;”fromfollowing line
;extension=php_mysql.dll
if php load mysql module successfully, you can see "mysql" module (NOT "mysqlnd" module) in phpinfo()
To Support openssl, remove ";" from following line (phplist with gmail setting must use openssl)
;extension=php_openssl.dll
if php load mysql module successfully, you can see "openssl" module in phpinfo()
3) (Optional)To enable short open tags(for example ...?>), find “short_open_tag”setting and change it tofollowing:
short_open_tag = On
4) (Optional)To display errormessages in your browser window for development, find “display_errors”settingand change it to following:
display_errors = On
6. Configure Apache for PHP 5
Open%apache_dir%/conf/httpd.conf file,
1) Add php module
If usingApache 2.0.x, add following line after all the LoadModule statements:
LoadModulephp5_module "d:/php5/php5apache2.dll"
If usingApache 2.2.x, add the following line instead:
LoadModulephp5_module "d:/php5/php5apache2_2.dll"
注意:使用的是“/”,而不是“/”
2) Add php type
Searchfor "AddType" in the file, and add the following line after the last"AddType" statement
AddTypeapplication/x-httpd-php .php
AddTypeapplication/x-httpd-php .phtml
3) Indicate the location folder ofyour PHP ini file
Add the following line to the end of your httpd.conf file.
PHPIniDir"d:/php5"
注意:使用的是“/”,而不是“/”
4) Find “DirectoryIndex” setting,and change it to
DirectoryIndex index.php index.html
5) Save httpd.conf file and restartapache server
7. Create a test.php file in rootpath, the content is following:
Tryit fromhttp://localhost/test.php
注意:不再需要在环境变量“path”里添加php的安装目录

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

PHP和Python各有优势,选择依据项目需求。1.PHP适合web开发,尤其快速开发和维护网站。2.Python适用于数据科学、机器学习和人工智能,语法简洁,适合初学者。

要在 Apache 中设置 CGI 目录,需要执行以下步骤:创建 CGI 目录,如 "cgi-bin",并授予 Apache 写入权限。在 Apache 配置文件中添加 "ScriptAlias" 指令块,将 CGI 目录映射到 "/cgi-bin" URL。重启 Apache。

PHP仍然具有活力,其在现代编程领域中依然占据重要地位。1)PHP的简单易学和强大社区支持使其在Web开发中广泛应用;2)其灵活性和稳定性使其在处理Web表单、数据库操作和文件处理等方面表现出色;3)PHP不断进化和优化,适用于初学者和经验丰富的开发者。

启动 Apache 的步骤如下:安装 Apache(命令:sudo apt-get install apache2 或从官网下载)启动 Apache(Linux:sudo systemctl start apache2;Windows:右键“Apache2.4”服务并选择“启动”)检查是否已启动(Linux:sudo systemctl status apache2;Windows:查看服务管理器中“Apache2.4”服务的状态)启用开机自动启动(可选,Linux:sudo systemctl

PHP用于构建动态网站,其核心功能包括:1.生成动态内容,通过与数据库对接实时生成网页;2.处理用户交互和表单提交,验证输入并响应操作;3.管理会话和用户认证,提供个性化体验;4.优化性能和遵循最佳实践,提升网站效率和安全性。

当 Apache 80 端口被占用时,解决方法如下:找出占用该端口的进程并关闭它。检查防火墙设置以确保 Apache 未被阻止。如果以上方法无效,请重新配置 Apache 使用不同的端口。重启 Apache 服务。

PHP在电子商务、内容管理系统和API开发中广泛应用。1)电子商务:用于购物车功能和支付处理。2)内容管理系统:用于动态内容生成和用户管理。3)API开发:用于RESTfulAPI开发和API安全性。通过性能优化和最佳实践,PHP应用的效率和可维护性得以提升。

PHP在数据库操作和服务器端逻辑处理中使用MySQLi和PDO扩展进行数据库交互,并通过会话管理等功能处理服务器端逻辑。1)使用MySQLi或PDO连接数据库,执行SQL查询。2)通过会话管理等功能处理HTTP请求和用户状态。3)使用事务确保数据库操作的原子性。4)防止SQL注入,使用异常处理和关闭连接来调试。5)通过索引和缓存优化性能,编写可读性高的代码并进行错误处理。
