Apache+PHP配置过程详解
2015-08-05 10:33
766 查看
转自:http://blog.sina.com.cn/s/blog_6d09b5750100w965.html
这两天在搭环境,能出现的问题都出现了
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的支持
LoadModulephp5_module
"C:/ProgramFiles/PHP/php5apache2_2.dll"
PHPIniDir"C:/Program
Files/PHP"
(2)实际工作的目录:
DocumentRoot"F:/ApcheWork"
<Directory"F:/ApcheWork">
<Directory"F:/WWW"
>
OptionsFollowSymLinks
AllowOverrideNone
Orderdeny,allow
allowfrom
all
</Directory>
(3)添加对index.php的支持
<IfModuledir_module>
DirectoryIndexindex.php
index.html
</IfModule>
(4) 添加类型支持
AddTypeapplication/x-httpd-php
.php
AddTypeapplication/x-httpd-php
.html
AddTypeapplication/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' - seescripts/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' - seescripts/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';
问题5:如果出现找不到php5apatch2_2.dll
重新到官网http://windows.php.net/download下载ThreadSafe版本的php包,解压完了后记得重新配置php.ini(在解压后呈现为php.ini-development,q)
这两天在搭环境,能出现的问题都出现了
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的支持
LoadModulephp5_module
"C:/ProgramFiles/PHP/php5apache2_2.dll"
PHPIniDir"C:/Program
Files/PHP"
(2)实际工作的目录:
DocumentRoot"F:/ApcheWork"
<Directory"F:/ApcheWork">
<Directory"F:/WWW"
>
OptionsFollowSymLinks
AllowOverrideNone
Orderdeny,allow
allowfrom
all
</Directory>
(3)添加对index.php的支持
<IfModuledir_module>
DirectoryIndexindex.php
index.html
</IfModule>
(4) 添加类型支持
AddTypeapplication/x-httpd-php
.php
AddTypeapplication/x-httpd-php
.html
AddTypeapplication/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' - seescripts/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' - seescripts/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';
问题5:如果出现找不到php5apatch2_2.dll
重新到官网http://windows.php.net/download下载ThreadSafe版本的php包,解压完了后记得重新配置php.ini(在解压后呈现为php.ini-development,q)
相关文章推荐
- Visual Studio 2015 和 Apache Cordova 跨平台开发入门(一)
- ubuntu15.10 安装 lampp
- Apache Vysper
- apache代理服务器为nodejs服务设置域名
- WAMPServer2.5中升级PHP/Apache
- Ubuntu配置Apache+PHP+MySQL
- kibana apache密码验证登录
- Apache HBase Region Splitting and Merging
- Linux下面怎样可以把Apache网站根目录:/var/www/html/ 设置成Vsftp默认目录?
- Apache Thrift - 可伸缩的跨语言服务开发框架
- 搭建 lamp环境【apache2.4.12 + php5.5.12 + mysql5.6.13】
- Linux上手动编译apache
- kafka 简单介绍
- apache kafka中server.properties配置文件参数说明
- 【Apache学习】linux文件目录以网页列表形式访问
- exception in thread main org.apache.spark.sparkexception:A master URL must be set in your
- Visual Studio 2013搭建phoneGap(Apache Cordova)开发环境
- Apache Traffic Server 简介
- apache commons collections CollectionUtils工具类简单使用
- Apache DS UML