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.生成動態內容,通過與數據庫對接實時生成網頁;2.處理用戶交互和表單提交,驗證輸入並響應操作;3.管理會話和用戶認證,提供個性化體驗;4.優化性能和遵循最佳實踐,提升網站效率和安全性。

PHP在電子商務、內容管理系統和API開發中廣泛應用。 1)電子商務:用於購物車功能和支付處理。 2)內容管理系統:用於動態內容生成和用戶管理。 3)API開發:用於RESTfulAPI開發和API安全性。通過性能優化和最佳實踐,PHP應用的效率和可維護性得以提升。

PHP仍然具有活力,其在現代編程領域中依然佔據重要地位。 1)PHP的簡單易學和強大社區支持使其在Web開發中廣泛應用;2)其靈活性和穩定性使其在處理Web表單、數據庫操作和文件處理等方面表現出色;3)PHP不斷進化和優化,適用於初學者和經驗豐富的開發者。

當 Apache 80 端口被佔用時,解決方法如下:找出佔用該端口的進程並關閉它。檢查防火牆設置以確保 Apache 未被阻止。如果以上方法無效,請重新配置 Apache 使用不同的端口。重啟 Apache 服務。

PHP主要是過程式編程,但也支持面向對象編程(OOP);Python支持多種範式,包括OOP、函數式和過程式編程。 PHP適合web開發,Python適用於多種應用,如數據分析和機器學習。

Apache 連接數據庫需要以下步驟:安裝數據庫驅動程序。配置 web.xml 文件以創建連接池。創建 JDBC 數據源,指定連接設置。從 Java 代碼中使用 JDBC API 訪問數據庫,包括獲取連接、創建語句、綁定參數、執行查詢或更新以及處理結果。
