Apache+PHP配置過程詳解

文字轉載自https://blog.51cto.com/samyubw/322173
Apache+PHP配置過程詳解
經過兩晚上的奮鬥終於將Apache配置PHP成功,安裝配置過程中走了不少彎路,特記錄之。
1.Apache配置PHP個人認爲首先要注意的是Apache和PHP的版本信息,不同的版本之間所要進行設置的參數是不同的,開始的盲目讓自己受盡了苦頭。
2.選擇版本:Apache 2.2.14 PHP:5.2.5 具體細節不再贅述。。。
3.驗證Apache和PHP是否安裝成功:
(1) Apache: http://localhost
(2)PHP:在dos窗口下運行php -i
4.PHP配置文件php.ini
(1)修改:
extension_dir = “./”
extension_dir = "C:/Program Files/PHP/ext" (自己安裝PHP的實際目錄下ext子目錄的路徑)
(2)取消註釋以支持mysql數據庫
extension=php_mysql.dll
extension=php_mysqli.dll
(3)環境變量:
PHPRC: C:\Program Files\PHP
Path中添加:C:\Program Files\PHP
將文件liblibmysql.dll 拷貝入C:\WINDOWS\system32
(這一步不進行可能會報Httpd.exe錯誤)
5.Apache配置文件httpd.conf
(1)添加對php的支持
LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"
PHPIniDir "C:/Program Files/PHP"
(2)實際工作的目錄:
DocumentRoot "F:/ApcheWork"
<Directory "F:/ApcheWork">
<Directory "F:/WWW" >
Options FollowSymLinks
AllowOverride None
Order deny,allow
allow from all
</Directory>
(3)添加對index.php的支持
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
(4) 添加類型支持
AddType application/x-httpd-php .php
AddType application/x-httpd-php .html
AddType application/x-httpd-php .php .phtml .php3 .php4
AddType application/x-httpd-php-source .phps

附:配置PhpMyAdmin過程中出現的問題及解決方法
問題1:沒有找到 PHP 擴展 mbstring,而您現在好像在使用多字節字符集。沒有 mbstring 擴展的 phpMyAdmin 不能正確分割字符串,可能產生意想不到的結果。
解決方法:
編輯PHP配置文件php.ini,

;extension=php_mbstring.dll
改成
extension=php_mbstring.dll

問題2:無法加載 mcrypt 擴展 請檢查您的 php 配置。
解決方法:
(1)找到php目錄下的libmcrypt.dll,並將libmcrypt.dll複製到C:\windows \system32目錄中
(2)編輯PHP配置文件php.ini,,
將“;extension=php_mcrypt.dll”
改成extension=php_mcrypt.dll
問題3:鏈接表的額外特性尚未激活。
解決方法:
(1)選取目錄下scripts/ create_tables.sql 文件,再點擊執行,會自動生成一個名爲phpmyadmin的數據庫。
(2)用PHP編輯器打開config.inc.php文件,找到:
$cfg['Servers'][$i]['pmadb'] = ''; // 'phpmyadmin' - see scripts/create_tables.sql
$cfg['Servers'][$i]['bookmarktable'] = ''; // 'pma_bookmark'
$cfg['Servers'][$i]['relation'] = ''; // 'pma_relation'
$cfg['Servers'][$i]['table_info'] = ''; // 'pma_table_info'
$cfg['Servers'][$i]['table_coords'] = ''; // 'pma_table_coords'
$cfg['Servers'][$i]['pdf_pages'] = ''; // 'pma_pdf_pages'
$cfg['Servers'][$i]['column_info'] = ''; // 'pma_column_info'
$cfg['Servers'][$i]['history'] = ''; // 'pma_history'
改成:
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; // 'phpmyadmin' - see scripts/create_tables.sql
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark'; // 'pma_bookmark'
$cfg['Servers'][$i]['relation'] = 'pma_relation'; // 'pma_relation'
$cfg['Servers'][$i]['table_info'] = 'pma_table_info'; // 'pma_table_info'
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords'; // 'pma_table_coords'
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages'; // 'pma_pdf_pages'
$cfg['Servers'][$i]['column_info'] = 'pma_column_info'; // 'pma_column_info'
$cfg['Servers'][$i]['history'] = 'pma_history'; // 'pma_history'
問題4:配置文件現在需要一個短語密碼。
解決方法:
編輯配置文件config.inc.php,修改下項參數:$cfg['blowfish_secret'] = '123456';

附件:http://down.51cto.com/data/2355887

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章