php 环境搭建

来源:互联网 发布:mysql my.ini配置下载 编辑:程序博客网 时间:2024/06/05 19:38

1 基本信息配置

1.1    Apache 配置

ServerRoot "F:/Program Files (x86)/Apache Software Foundation/Apache2.2"

Listen 80

LoadModule actions_module modules/mod_actions.so

LoadModule alias_module modules/mod_alias.so

LoadModule asis_module modules/mod_asis.so

LoadModule auth_basic_module modules/mod_auth_basic.so

LoadModule authn_default_module modules/mod_authn_default.so

LoadModule authn_file_module modules/mod_authn_file.so

LoadModule authz_default_module modules/mod_authz_default.so

LoadModule authz_groupfile_module modules/mod_authz_groupfile.so

LoadModule authz_host_module modules/mod_authz_host.so

LoadModule authz_user_module modules/mod_authz_user.so

LoadModule autoindex_module modules/mod_autoindex.so

LoadModule cgi_module modules/mod_cgi.so

LoadModule dir_module modules/mod_dir.so

LoadModule env_module modules/mod_env.so

LoadModule include_module modules/mod_include.so

LoadModule isapi_module modules/mod_isapi.so

LoadModule log_config_module modules/mod_log_config.so

LoadModule mime_module modules/mod_mime.so

LoadModule negotiation_module modules/mod_negotiation.so

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule setenvif_module modules/mod_setenvif.so

<IfModule !mpm_netware_module>

<IfModule !mpm_winnt_module>

User daemon

Group daemon

</IfModule>

</IfModule>

ServerAdmin 94129057@qq.com

DocumentRoot "F:/brucephp"

<Directory />

    Options FollowSymLinks

    AllowOverride All

    Order deny,allow

    Allow from all

</Directory>

<Directory "F:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs">

    Options Indexes FollowSymLinks

    AllowOverride All

    Order allow,deny

    Allow from all

</Directory>

<IfModule dir_module>

    DirectoryIndex   index.php index.html

</IfModule>

<FilesMatch "^\.ht">

    Order allow,deny

    Deny from all

    Satisfy All

</FilesMatch>

ErrorLog "logs/error.log"

LogLevel warn

<IfModule log_config_module>

    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>

      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

    </IfModule>

    CustomLog "logs/access.log" common

</IfModule>

<IfModule alias_module>

    ScriptAlias /cgi-bin/ "F:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin/"

</IfModule>

<IfModule cgid_module>

</IfModule>

<Directory "F:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin">

    AllowOverride All

    Options None

    Order allow,deny

    Allow from all

</Directory>

DefaultType text/plain

<IfModule mime_module>

    TypesConfig conf/mime.types

    AddType application/x-compress .Z

    AddType application/x-gzip .gz .tgz

</IfModule>

Include conf/extra/httpd-vhosts.conf

<IfModule ssl_module>

SSLRandomSeed startup builtin

SSLRandomSeed connect builtin

</IfModule>

LoadModule php5_module "F:\php\php5apache2_2.dll"

AddHandler application/x-httpd-php .php

AddHandler application/x-httpd-php .htm

PHPIniDir "F:/php"

1.2    配置虚拟主机

C:\Windows\System32\drivers\etc\hosts文件中增加一行127.0.0.1      www.bruceplace.com

修改httpd-vhosts.conf文件,增加一部分

 <VirtualHost *:80>

    ServerAdmin 94129057@qq.com

    DocumentRoot "F:/www/places/public"

     #欢迎页面 

    DirectoryIndex index.php

    <Directory "F:/www/places/public"> 

    Options -Indexes FollowSymLinks 

    AllowOverride All 

    Order allow,deny 

    Allow from all 

    </Directory> 

    ServerName www.bruceplace.com

    ErrorLog "logs/bruceplace-error.log"

    CustomLog "logs/bruceplace-access.log" common

</VirtualHost>

1.3    PHP配置

添加此框架路径到你的php.ini配置文件中include_path设置里的 library下的子目录。
就这样,Zend Framework 已经安装好

include_path = ".;F:\php\includes;F:\tools\webproject\Custom\ZendFramework-1.11.1\library;"

配置php错误文件

error_reporting 错误级别定义

常见的错误级别

; E_ALL - 所有的错误和警告 
; E_ERROR -
致命性运行时错 
; E_WARNING -
运行时警告(非致命性错) 
; E_PARSE -
编译时解析错误 
; E_NOTICE -
运行时提醒(这些经常是是你的代码的bug引起的

默认 error_reporting  =  E_ALL & ~E_NOTICE意思是说 显示所有错误,但运行时的提醒除外。

 

error_log 是否将错误信息写入日志

On 将错误信息记录日志,Off不记录日志。那些错误会被记录也是依据error_reporting定义,跟display_error无关。

如果将错误信息记录到日志,应该设置下日志文件位置,error_log。如果为Off则不需要。

例如:

log_errors = On

error_log ="/logs/php.log"

 

 

2.  Apache配置PHP个人认为首先要注意的是ApachePHP的版本信息,不同的版本之间所要进行设置的参数是不同的,开始的盲目让自己受尽了苦头。

     Apache/2.2.25 (Win32) PHP/5.4.20

   查看版本信息方法

     (1) Apache: http://localhost

    (2)PHP:dos窗口下运行php -i
 
 
3  下面配置,决定那个主页文件先被执行。
<IfModule dir_module>
    DirectoryIndex   index.php index.html  
</IfModule>
4. 设置默认的主页
DocumentRoot "F:/www"
<Directory "F:/www">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
 # Virtual hosts  注意 ,打开后  DocumentRoot目录无法访问了
# Include conf/extra/httpd-vhosts.conf

 

 

 

  

0 0