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 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

メモ帳++7.3.1
使いやすく無料のコードエディター

SublimeText3 中国語版
中国語版、とても使いやすい

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ドリームウィーバー CS6
ビジュアル Web 開発ツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

ホットトピック









PHPとPythonにはそれぞれ独自の利点があり、プロジェクトの要件に従って選択します。 1.PHPは、特にWebサイトの迅速な開発とメンテナンスに適しています。 2。Pythonは、データサイエンス、機械学習、人工知能に適しており、簡潔な構文を備えており、初心者に適しています。

ApacheでCGIディレクトリを設定するには、次の手順を実行する必要があります。「CGI-Bin」などのCGIディレクトリを作成し、Apacheの書き込み許可を付与します。 Apache構成ファイルに「Scriptalias」ディレクティブブロックを追加して、CGIディレクトリを「/cgi-bin」URLにマッピングします。 Apacheを再起動します。

PHPは依然として動的であり、現代のプログラミングの分野で重要な位置を占めています。 1)PHPのシンプルさと強力なコミュニティサポートにより、Web開発で広く使用されています。 2)その柔軟性と安定性により、Webフォーム、データベース操作、ファイル処理の処理において顕著になります。 3)PHPは、初心者や経験豊富な開発者に適した、常に進化し、最適化しています。

Apacheを開始する手順は次のとおりです。Apache(コマンド:sudo apt-get install apache2または公式Webサイトからダウンロード)をインストールします(linux:linux:sudo systemctl start apache2; windows:apache2.4 "serviceを右クリックして「開始」を右クリック) (オプション、Linux:Sudo SystemCtl

PHPは動的なWebサイトを構築するために使用され、そのコア関数には次のものが含まれます。1。データベースに接続することにより、動的コンテンツを生成し、リアルタイムでWebページを生成します。 2。ユーザーのインタラクションを処理し、提出をフォームし、入力を確認し、操作に応答します。 3.セッションとユーザー認証を管理して、パーソナライズされたエクスペリエンスを提供します。 4.パフォーマンスを最適化し、ベストプラクティスに従って、ウェブサイトの効率とセキュリティを改善します。

PHPは、電子商取引、コンテンツ管理システム、API開発で広く使用されています。 1)eコマース:ショッピングカート機能と支払い処理に使用。 2)コンテンツ管理システム:動的コンテンツの生成とユーザー管理に使用されます。 3)API開発:RESTFUL API開発とAPIセキュリティに使用されます。パフォーマンスの最適化とベストプラクティスを通じて、PHPアプリケーションの効率と保守性が向上します。

Apacheから追加のservernameディレクティブを削除するには、次の手順を実行できます。追加のservernameディレクティブを識別して削除します。 Apacheを再起動して変更を有効にします。構成ファイルを確認して、変更を確認します。サーバーをテストして、問題が解決されていることを確認します。

Apache 80ポートが占有されている場合、ソリューションは次のとおりです。ポートを占有するプロセスを見つけて閉じます。ファイアウォールの設定を確認して、Apacheがブロックされていないことを確認してください。上記の方法が機能しない場合は、Apacheを再構成して別のポートを使用してください。 Apacheサービスを再起動します。
