Heim > Artikel > Backend-Entwicklung > PHP学习启动,环境大搭建
PHP学习起步,环境大搭建
本文章教你如何一步一步搭起PHP开发环境
虽然在网上可以随便找到相关的PHP搭建环境,可是我觉得有几点不好,搭建的方式不一,使得开发者不知道相信谁的话,其二,对于开发者在搭建的过程中遇到的问题避而不答,我觉得这是最要命的。其三,搭配的版本不一,其涉及的搭配核心没有告诉开发者,于下,我将避重就轻,介绍PHP环境的搭建和测试。
1 2
3
4
|
#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL PHPIniDir "D:/PHP" LoadModule php5_module "D:/PHP/php5apache2_2.dll" #END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL <span style="color: #008200;"><span style="font-size: 1em !important; line-height: 1.1em !important; white-space: pre !important;"></span></span><p style="font-size: 1em !important; line-height: 1.1em !important; white-space: pre !important; margin-bottom: 22px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-color: initial; vertical-align: baseline; background-color: #f7f7f7;">但现在Apache还不具备PHP5的功能,因为还需要对PHP进行一些配置,需要编辑PHP目录下的php.ini文件<span style="color: #008200 !important;">(</span><span style="color: #ff0000;">如果是PHP压缩包的话,要将<span >php.ini-dist”文件,将其重命名为“php.ini</span></span><span style="color: #008200;"></span></p>
<p style="margin-bottom: 22px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-color: initial; vertical-align: baseline; background-color: #f7f7f7;"><span ><span style="font-size: 1em !important; line-height: 1.1em !important; white-space: pre !important;"><span style="color: #008200;">)</span>,查看一下externsion_ext变量是不是指定到PHP目录下的ext文件夹,这个文件夹下放置着一些可能会用到的功能dll文件:</span></span></p>
<div style="color: #008200 !important; font-size: 1em !important; line-height: 1.1em !important; white-space: pre !important; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-color: initial; vertical-align: baseline; background-color: #f7f7f7;"><div class="syntaxhighlighter bash" style="margin-top: 1em !important; margin-right: 0px !important; margin-bottom: 1em !important; margin-left: 0px !important; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-color: initial; font-size: 1em !important; vertical-align: baseline; width: 620px; background-color: white !important;">
<table style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; font-size: 1em !important; vertical-align: baseline !important; background-image: none !important; background-color: initial !important; border-collapse: collapse; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; border-color: initial !important; float: none !important; height: auto !important; line-height: 1.1em !important; text-align: left !important; width: 620px; direction: ltr !important;">php.ini<tr style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-color: initial !important; font-size: 1em !important; vertical-align: baseline !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; background-color: initial !important; float: none !important; height: auto !important; line-height: 1.1em !important; width: auto !important; direction: ltr !important;">
<td class="gutter" style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; font-size: 1em !important; vertical-align: baseline !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; background-color: initial !important; border-color: initial !important; float: none !important; height: auto !important; line-height: 1.1em !important; width: auto !important; direction: ltr !important; color: #afafaf !important;"><div class="line number1 index0 alt2" style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 0.5em !important; padding-bottom: 0px !important; padding-left: 1em !important; border-top-width: 0px !important; border-right-width: 3px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-color: initial !important; font-size: 1em !important; vertical-align: baseline !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; background-color: white !important; float: none !important; height: auto !important; line-height: 1.1em !important; text-align: right !important; width: auto !important; direction: ltr !important; white-space: pre !important; border-right-style: solid !important; border-right-color: #6ce26c !important;">1</div></td>
<td class="code" style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; font-size: 1em !important; vertical-align: baseline !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; background-color: initial !important; border-color: initial !important; float: none !important; height: auto !important; line-height: 1.1em !important; width: 591px; direction: ltr !important;"><div class="container" style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-color: initial !important; font-size: 1em !important; vertical-align: baseline !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; background-color: initial !important; float: none !important; height: auto !important; line-height: 1.1em !important; width: auto !important; direction: ltr !important;"><div class="line number1 index0 alt2" style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 1em !important; padding-bottom: 0px !important; padding-left: 1em !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-color: initial !important; font-size: 1em !important; vertical-align: baseline !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; background-image: none !important; background-color: white !important; float: none !important; height: auto !important; line-height: 1.1em !important; width: auto !important; direction: ltr !important; white-space: pre !important;">
<code class="bash plain" style="margin-top: 0px !important; margin-right: 0px !important; margin-bottom: 0px !important; margin-left: 0px !important; padding-top: 0px !important; padding-right: 0px !important; padding-bottom: 0px !important; padding-left: 0px !important; border-top-width: 0px !important; border-right-width: 0px !important; border-bottom-width: 0px !important; border-left-width: 0px !important; border-color: initial !important; font-size: 1em !important; vertical-align: baseline !important; background-image: none !important; background-color: initial !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-bottom-right-radius: 0px !important; border-bottom-left-radius: 0px !important; float: none !important; height: auto !important; line-height: 1.1em !important; width: auto !important; direction: ltr !important; display: inline !important;">extension_dir= "D:\PHP\ext"
|
然后需要打开PHP的MYSQL功能,将如下行的注释(以分号;开头的行)去掉,并将其余暂时用不到externsion用注释(;)关闭掉。
1 2
3
4
5
6
7
8
|
extension=php_curl.dll extension=php_gd2.dll extension=php_mbstring.dll extension=php_mysql.dll extension=php_pdo.dll extension=php_pdo_mysql.dll extension=php_pdo_odbc.dll extension=php_xmlrpc.dll |
配置完成,重启Apache服务器,如果没什么意外的话,这样的配置是不会出错的。