ホームページ  >  記事  >  php教程  >  PHP 環境設定 php5 mysql5 apache2 phpmyadmin のインストールと設定

PHP 環境設定 php5 mysql5 apache2 phpmyadmin のインストールと設定

WBOY
WBOYオリジナル
2016-06-13 12:37:071182ブラウズ

PHPの環境構築は初心者にとって確かに面倒な作業です。必ず何らかの問題に遭遇し、多くの回り道をすることになります。
そこで、今日は特別にこの設定ドキュメントを作成しました。次の手順に従うことで成功すると信じています。また、私が間違っている場合は、皆さん
が私を訂正してくれることを願っています。
その他の記事 php ファン サイト http://www.phpfans.net

この例は、wiondws での apache2.0.55 php5.1.1 (zip) mysql5.0.19 phpmyadmin2.7.0 のインストールと構成です
上記のリソースは http://www.phpfans.net/download.php/

/*
著者: 私は魚ではありません
ウェブサイト: http:// www .phpfans.net
ブログ: http://www.phpfans.net/space/index.php/2
email:deng5765@163.com
*/

Apache のインストール
1 Apache インストール パッケージをクリックします
screen.width*0.7) {this.resize=true; ; this.style.cursor='hand'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" onclick="if(!this.resize) {return true;} else { window.open('/upload/20061117134330520.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/04213021P-0.jpg" onload=" if( this.width>screen.width*0.7) {this.resize=true; this.width=screen.width*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小します';} " =0>

2 次の 3 つの項目を任意に入力します
Apache はポート 80 をリッスンします。iis がポート 80 を使用する場合、競合を避けるために iis ポートまたは Apache ポートを変更します
screen.width *0.7) {this.resize=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小します'; }" onclick ="if(!this.resize) {return true;} else {window.open('/upload/20061117134333421.jpg');}" alt="" src="http://www.bkjia. com/uploads /allimg/131016/042130O54-1.jpg" onload="if(this.width>screen.width*0.7) {this.resize=true; this.alt= 'ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" border=0>

3 ここでのデフォルトは一般的です。インストール経路を変更する場合はカスタムを選択することもできます。注意してください。インストール経路には中文
screen.width*0.7) {this.resize=true; this.width=画面幅*0.7; this.style.cursor='手'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window.open('/upload/20061117134333562.jpg) ');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421303335-2.jpg" onload="if(this.width>screen.width*0.7) { this.resize=true; this.width=画面幅*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" border=0>

4 开始インストール
screen.width*0.7) {this.resize=true ; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小します';}" onclick="if(! .resize) {return true;} else {window.open('/upload/20061117134333178.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/04213025R -3.jpg" onload="if(this.width>screen.width*0.7) {this.resize=true; this.width=screen.width*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウス ホイールズームイン/アウトします';}" border=0>

5 インストールが完了した後、浏览器にアクセスします http://localhost
結果がこの面を確認できた場合、apache のインストールが成功しました、すでに完了しています可解释静态页面了
screen.width*0.7) {this.resize=true; this.width=画面幅*0.7; this.style.cursor='手'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールを押して拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window.open('/upload/20061117134333802.jpg) ');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421302Z8-4.jpg" onload="if(this.width>screen.width*0.7) { this.resize=true; this.width=画面幅*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールでズームイン/アウト';}" border=0>

MySQL のインストール

1 点击mysql安装包
screen.width*0.7) {this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window.open('/upload/20061117134334711.jpg) ');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/04213011O-5.jpg" onload="if(this.width>screen.width*0.7) { this.resize=true; this.width=screen.width*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" border=0>

2 默认通常、インストール経路を変更する場合はカスタムを選択することもできます。 this.width=画面幅*0.7; this.style.cursor='手'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window.open('/upload/20061117134334786.jpg) ');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421303145-6.jpg" onload="if(this.width>screen.width*0.7) { this.resize=true; this.width=画面幅*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" border=0>

3 取り付け开始
screen.width*0.7) {this.resize=true ; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小します';}" onclick="if(! .resize) {return true;} else {window.open('/upload/20061117134334901.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/042130A12 -7.jpg" onload="if(this.width>screen.width*0.7) {this.resize=true; this.width=screen.width*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウス ホイールズームイン/ズームアウトします';}" border=0>

4 跳过注册
screen.width*0.7) {this.resize=true; this.width=画面幅*0.7; this.style.cursor='手'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window.open('/upload/20061117134334493.jpg) ');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421305O3-8.jpg" onload="if(this.width>screen.width*0.7) { this.resize=true; this.width=画面幅*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" border=0>

5 が mysql に存在するかどうか。その後、菜の構成ウィザードを開始して構成
を実行することもできます。ここでは構成
screen.width*0.7) {this.resize=true; を実行します。 this.width=画面幅*0.7; this.style.cursor='手'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールを押して拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window.open('/upload/20061117134335500.jpg) ');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421303929-9.jpg" onload="if(this.width>screen.width*0.7) { this.resize=true; this.width=画面幅*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" border=0>

6 选择詳細設定,点次继续
screen.width*0.7) { this.resize=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小します';}" onclick= "if(!this.resize) {return true;} else {window.open('/upload/20061117134335170.jpg');}" alt="" src="http://www.bkjia.com/uploads/ allimg/131016/042130KQ-10.jpg" onload="if(this.width>screen.width*0.7) {this.resize=true; this.width=screen.width*0.7; ここをクリックしてください新しいウィンドウを開くnCTRL マウスホイールでズームイン/ズームアウト';}" border=0>

7 以下はmysql应是何种型,第一种是开发服务器,
のみ使用2 番目のタイプは通常の WEB サーバーで、内部に保存されているものだけが使用されます。
最後のタイプは、このサーバー上の mysql データのみで、すべての内部保存を使用します。ここでは公開サーバーのみを選択します。ポイント次の行
screen.width*0.7) {this.resize=true; this.width=画面幅*0.7; this.style.cursor='手'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window.open('/upload/20061117134335825.jpg) ');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/042130B96-11.jpg" onload="if(this.width>screen.width*0.7) { this.resize=true; this.width=画面幅*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールでズームイン/アウト';}" border=0>

8 下は选择データ据库使用、第一种は多機能使用、
データベースを非常に優れた innodb(事务) 保存タイプと高効率の myisam(非事务) 保存タイプに変換します。
の 2 番目のタイプは、事処理タイプのみに使用される、最も優れた innodb の拡張ですが、同時にサポートされます。 myisam、myisam だけが全文インデックスをサポートします
最後の 1 つの必須処理タイプは、単一のアプリケーションに適しており、サポートされていない myisam タイプのみがサポートされています。
一般に、最初の多機能が選択されます。 🎜>screen.width*0.7) {this.resize=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールでズームしますin/out';}" onclick="if(!this.resize) {return true;} else {window.open('/upload/20061117134335511.jpg');}" alt="" src="http:/ /www.bkjia.com/uploads/allimg/131016/0421305954-12.jpg" onload="if(this.width>screen.width*0.7) {this.resize=true; ; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウス ホイールを使用して拡大/縮小';}" border=0>

9 以下は InnodDB のデータ保存場所です。変更
screen.width*0.7) {this.resize=true; this.width=画面幅*0.7; this.style.cursor='手'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウス ホイールを押して拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window.open('/upload/20061117134336911.jpg) ');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/042130KB-13.jpg" onload="if(this.width>screen.width*0.7) { this.resize=true; this.width=画面幅*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールでズームイン/アウト';}" border=0>

10 下は选择mysql允许の最大接続数、第一种は最大20個です接続して送信します。
2 番目は最大 500 個で接続を送信し、最後の 1 つは独自のもので、必要に応じて選択できます。
ここで最初の 1 つを選択します
screen.width*0.7) {this.width=screen.width*0.7; this.style.cursor='hand'; をクリックしますここで新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window.open('/upload/20061117134336287.jpg');}" alt ="" src="http://www.bkjia.com/uploads/allimg/131016/0421304423-14.jpg" onload="if(this.width>screen.width*0.7) {this.resize=true; this.width=screen.width*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" border=0>

11次のポートを選択しますデータベース監視、一般的なデフォルトは 3306 です。別のポートに変更すると、
今後データベースに接続するときに変更したポートを覚えておかなければ、mysql データベースに接続できなくなります。
面倒です。ここでは何も変更せず、mysq のデフォルトのポート :3306
screen.width*0.7) {this.width=screen.width*0.7; を使用します。 'hand'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window.open('/upload) /20061117134336807.jpg');}" alt="" src=" http://www.bkjia.com/uploads/allimg/131016/04213045Z-15.jpg" onload="if(this.width>screen.width *0.7) {this.resize=true; this.width=screen.width*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小します';}" border=0>

12 このステップでは、mysql のデフォルトのエンコーディングを設定します。デフォルトでは、標準エンコーディング
screen.width*0.7) {this.width=screen.width*0.7; Cursor='hand'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window.open(' /upload/20061117134336376.jpg');}" alt="" src= "http://www.bkjia.com/uploads/allimg/131016/04213050B-16.jpg" onload="if(this.width>screen) .width*0.7) {this.resize=true; this.width=screen .width*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小します';}" border=0>

13 もちろん、gb2312 または必要に応じて gbk に変更できます。エンコーディングはバージョン 4.1 以降で導入されました。
元のデータベースのデータを使用する場合は、元のデータベースが使用しているエンコードを確認するのが最善です。
で設定したエンコードが元のデータベースのデータのエンコードと一致しない場合、文字化けが発生する可能性があります。使用する場合は、latin1 標準エンコーディングを使用することをお勧めします
screen.width*0.7) {this.width=screen.width*0.7; this.style.cursor='hand'; alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window.open('/upload/20061117134337691.jpg') ;}" alt="" src= "http://www.bkjia.com/uploads/allimg/131016/0421304H3-17.jpg" onload="if(this.width>screen.width*0.7) {これ。 resize=true; this.width=screen .width*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" border=0>

14 このステップはmysql を Windows サービスとして設定するかどうかは、通常はサービスに設定することを選択します
。これにより、今後サービスを通じて mysql データベースを開始および終了できるようになります。推奨: 以下のチェックボックスもオンにします
。 cmd モードで mysql にアクセスする必要がないように、bin ディレクトリでコマンドを実行します。
screen.width*0.7) {this.resize=true; =screen.width*0.7; this.style.cursor='hand' ; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" onclick="if(!this.resize) true を返す;} else {window.open('/upload/20061117134337450.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421305927-18.jpg " onload="if(this.width>screen.width*0.7) {this.resize=true; this.width=screen.width*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大します/ out';}" border=0>

15 このステップでは、mysql のスーパー ユーザーのパスワードを設定します。このスーパー ユーザーは非常に重要です。
mysql に対する完全な権限を持っています。スーパー パスワードを設定して覚えておいてください。ユーザーパスワード
マシンは mysql サーバーへの接続に root ユーザーを使用するかどうかを選択するチェックボックスがあります。
この要件がある場合は、これもチェックしてください。
screen.width*0.7) {this.resize=true; this.width=画面幅*0.7; this.style.cursor='手'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window.open('/upload/20061117134337855.jpg) ');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421304110-19.jpg" onload="if(this.width>screen.width*0.7) { this.resize=true; this.width=画面幅*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウス ホイールで拡大/縮小';}" border=0>

16 点击 実行
screen.width*0.7) {this.resize=true ; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小します';}" onclick="if(! .resize) {return true;} else {window.open('/upload/20061117134338697.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421304402 -20.jpg" onload="if(this.width>screen.width*0.7) {this.resize=true; this.width=screen.width*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウス ホイールズームイン/ズームアウトします';}" border=0>

17 到这一步
screen.width*0.7) {this.resize=true; this.width=画面幅*0.7; this.style.cursor='手'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window.open('/upload/20061117134338325.jpg) ');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421303019-21.jpg" onload="if(this.width>screen.width*0.7) { this.resize=true; this.width=画面幅*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールでズームイン/アウト';}" border=0>

18 我们可開始 mysql了,打开开開始菜单的 mysql コマンド ライン クライアント、输入密解
出现这个界面说明mysql已经安装好了
screen.width*0.7) {this.width=screen.width*0.7; this.style.cursor='hand'; .alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window.open('/upload/20061117134338105.jpg' );}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421304c8-22.jpg" onload="if(this.width>screen.width*0.7) {this .resize=true; this.width=screen.width*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" border=0>

発生する可能性のある問題:
場合、第 15 回の場合、表示されるインターフェイスは次のとおりです
screen.width*0.7) {this.resize=true; this.width=画面幅*0.7; this.style.cursor='手'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window.open('/upload/20061117134338728.jpg) ');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421302424-23.jpg" onload="if(this.width>screen.width*0.7) { this.resize=true; this.width=画面幅*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールでズームイン/アウト';}" border=0>
入力暗号の場所が 3 つあり、おそらく元来基地にインストールされています。你在第一文本框输入原ルート的秘密暗号,後二文本框输入ルート新密解,
点击次基础,出下图
screen.width*0.7) {this.resize=true ; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小します';}" onclick="if(! .resize) {return true;} else {window.open('/upload/20061117134339444.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421305351 -24.jpg" onload="if(this.width>screen.width*0.7) {this.resize=true; this.width=screen.width*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウス ホイールズームイン/ズームアウト';}" border=0>
给您推荐几种解决办法:
1、 点再試行、重试;
2、 再运行一次設定,看到有关 “移
3、 再構築します。 🎜> マシン上に他の mysql 関連のプログラムがない場合、また、保存されている必要のない my.ini ファイルも必ず取得されます。
更多文章 php爱好者站 http://www.phpfans.net




PHP のインストール
php は zip ファイル (非インストール版) ​​であるため、インストールは完全に で実行されます。 php5
1 找到php目录下のphp.ini-distまたはphp.ini.recommended文件、重命名はphp.ini
复制to系统盘のwindows目录下(以c:windows例)。

2 php 項目の下の php5ts.dll、libmysql.dll を項目 c:windowssystem32 に再度配置します。
libmysql.dll が system32 にコピーされていない場合、Apache の再起動時に次の警告が表示されることがあります。
screen.width*0.7) {this.width=screen.width*0.7; .cursor='hand'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" onclick="if(!this.resize) {return true;} else {window. '/upload/20061117134339956.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/0421304G0-25.jpg" onload="if(this.width> screen.width*0.7) {this.resize=true; this.width=screen.width*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小';}" border=0 >

3 php5ext ディレクトリ内の php_gd2.dll、php_mysql.dll、php_mbstring.dll ファイルを c:windowssystem32 にコピーします。
php_gd2.dll がロードされていない場合、php はイメージを処理できません。 php は mysql 関数ライブラリをサポートしません
php_mbstring.dll は、後で phpmyadmin を使用するときにワイド文字をサポートします

すべてがインストールされた後に設定します

php を設定し、MySQL を関連付けます
投稿に返信することでのみ、次の内容が表示されます
=========== === ================

c:windowsphp.ini ファイルを開きます

1 拡張子のパスを設定します
extension_dir を探しますそのような行があります
extension_dir = "./"
この行を
extension_dir = "C:php5ext"
に変更します。ここで、C:php5はphpをインストールしたパスです。パスが間違っている場合、DLL はロードされません
(注: 一部の PHP バージョンは、extension_dir = "./" であり、その前のセミコロンを削除する必要があります)

2 拡張機能を検索
extension =php_mbstring.dll
extension=php_gd2.dll
extension=php_mysql.dl
Apache の起動時にこれらの DLL がロードできるように、上記の 3 つの項目の前にあるセミコロンを削除します
もちろん、これらの DLL も system32 にコピーしました l

3 セッションの保存パスを設定します
session.save_path を探すと、そのような行があります
;
この行の後に行を追加します (最後ではなく行を追加することに注意してください)
session.save_path = "C:WINDOWSTemp"
一時ファイルに保存しますWindows の一時ディレクトリに保存できます。Temp

4 short_open_tag がデフォルトでオフであることにも注意してください。
つまり、php は
タグが短いため使いやすく、多くのプログラムも discuz などの短いタグで書かれています。
short_open_tag を変更しない場合
short_open_tag = Off
を検索するために、
を変更して、
short_open_tag = On
5 エラーを表示するかどうか。エラーの原因やエラー行数は表示されません。
このようにデバッグするのは非常に不便です。必要に応じて
を変更することをお勧めします。 to
display_errors = On

6 register_globals
セキュリティ上の理由から、デフォルトでも Off です
register_globals=Off の場合、次のプログラムは $_POST['user_name'] と $ を使用する必要があります_POST[受信時の 'user_pass' ])
register_globals=On の場合、次のプログラムは $user_name と $user_pass を直接使用して値を受け入れることができます。
更详细的说明请参考
http://www.phpfans.net/bbs/archiver/?tid-234.htm
建议根据自己需要修改

7 php5时差问题
时间相差八小时
为什么呢?PHP5系列版本新增了时区设置,默认为格林威治时间,与中国所在的东8区正好相差8个小时
查找date.timezone有这么一行
;date.timezone =
将;去掉,改成
date.timezone = PRC
其中PRC:People's Republic of China 中华人民共和国,
更详细解决方法请参考本论坛的
http://www.phpfans.net/bbs/archiver/?tid-60.html
更多文章 php爱好者站 http://www.phpfans.net

Apache整合PHP

1 从开始菜单打开apache配置文档,如图
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134339950.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/04213041O-26.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

2 修改网站根目录
查找 DocumentRoot有这么一行
DocumentRoot"C:/Program Files/Apache Group/Apache2/htdos"
这就是你网站的根目录,你可以修改,也可以用默认的.如果改,还要修改下面这项,否则可能会出现 403 错误
查找  This should be changed to whatever you set DocumentRoot to
在它下面两行有

把上面两项的 C:/Program Files/Apache Group/Apache2/htdos 改成你想要的目录

3 查找  DirectoryIndex index.html index.html.var
修改成
DirectoryIndex index.html index.html.var  index.php
这样index.php 可以充当默认页面了

4 Apache中模块化安装php
查找 # LoadModule foo_module modules/mod_foo.so
在此行后加入一行
LoadModule php5_module C:/php5/php5apache2.dll

其中C:/php5/php5apache2.dll是你安装php的相应路径.
注意不要把php5apache2.dll和php5apache.dll混淆.php5apache.dll只适用于apache 版本1的.
注意: PHP5压缩包里的php5apache2.dll只适用于apache2.0.*版本,如果是2.2.*以上版本,就可能会出现
"Cannot load C:/php/php5apache2.dll into server: The specified module could not be found."
或者:
"The requested operation has failed"
的情况.关于这个问题的解决方法可以参考本论坛的
http://www.phpfans.net/bbs/viewt ... &extra=page%3D1

5 查找 AddType application/x-gzip .gz .tgz
在此行后加入一行
AddType application/x-httpd-php .php
这样apache就可以解释php文件了
到这里配置基本完成了

########重启apache#########

在网站根目录下创建一个 phpinfo.php 文件

phpinfo();
?>

在浏览器打开
http://localhost/phpinfo.php
如果出现如下信息,则说明php已经配置好了
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('/upload/20061117134339543.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/04213053Y-27.jpg" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" border=0>

下面再测试php和mysql数据库的关联
在网站根目录下创建一个test.php 文件

CODE:
[Copy to clipboard]
<font color="#000000"><font color="#0000bb"></font><font color="#007700"><?</FONT><FONT color=#0000bb>php <BR>$link</FONT><FONT color=#007700>=</FONT><FONT color=#0000bb>mysql_connect</FONT><FONT color=#007700>(</FONT><FONT color=#dd0000>"localhost"</FONT><FONT color=#007700>,</FONT><FONT color=#dd0000>"root"</FONT><FONT color=#007700>,</FONT><FONT color=#dd0000>"12345"</FONT><FONT color=#007700>); </FONT><FONT color=#ff8000>//12345改成你的mysql密码 <BR></FONT><FONT color=#007700>if(!</FONT><FONT color=#0000bb>$link</FONT><FONT color=#007700>) echo </FONT><FONT color=#dd0000>"失败!"</FONT><FONT color=#007700>; <BR>else echo </FONT><FONT color=#dd0000>"成功!"</FONT><FONT color=#007700>; <BR></FONT><FONT color=#0000bb>mysql_close</FONT><FONT color=#007700>(); <BR>?> </font><br></font>
ブラウザで http://localhost/test.php を開きます
出力が成功した場合は、作業が完了したことを意味します。

インストール phpMyAdmin

phpMyAdmin-2.7.0.zip をダウンロードし、Web サイトのルート ディレクトリに解凍して名前を phpMyAdmin に変更し、
設定を見つけて開きます.defaut.php (一部のバージョンは config.inc.php または library/config.default.php)
次の変更を加えます:

1 次の 2 行でパスワードを見つけます
$cfg ['サーバー'][ $i]['ユーザー'] = 'root'
$cfg['サーバー'][$i]['パスワード'] = ''; $ cfg['Servers'][$i]['password'] = ''; 一重引用符内に mysql パスワードを入力します。

2 $cfg['PmaAbsoluteUri'] を検索して、phpMyAdmin ディレクトリのパスに設定します。例: http://localhost/phpMyAdmin/;

必要なコーディングに応じて次の 2 つの項目を変更します (データベースのコーディングにあまり慣れていない場合は、変更しないことをお勧めします)
3 $cfg['DefaultLang'] を検索し、zh-gb2312 に設定します。
4 $cfg['DefaultCharset'] を検索して、gb2312 に設定します。

ブラウザを開いて次のように入力します。 ://localhost/phpMyAdmin/ で、Apache と MySQL が起動されています。
以下のページが表示されれば、phpmyadmin がインストールされており、利用可能です。 width=screen.width*0.7; this.style.cursor='hand'; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大/縮小します';}" onclick="if(!this.resize) {return true;} else {window.open(' /upload/20061117134340474.jpg');}" alt="" src="http://www.bkjia.com/uploads/allimg/131016/04213014O-28. jpg" onload="if(this.width>screen .width*0.7) {this.resize=true; this.width=screen.width*0.7; this.alt='ここをクリックして新しいウィンドウを開きますnCTRL マウスホイールで拡大します/out';}" border=0>

phpMyAdmin の特定の機能についてよく理解してください。ここでは詳細には触れません。

==============================
その他の記事 php 愛好家サイト http:// www. phpfans.net

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。