zoukankan      html  css  js  c++  java
  • php环境搭建以及优化

    WampServer 配置伪静态

     httpd.conf文件

    搜索找到“LoadModule rewrite_module modules/mod_rewrite.so”这一行,去掉前面的“#”; 

    搜索找到“LoadModule rewrite_module modules/mod_rewrite.so”这一行,去掉前面的“#”; 

    新建.haccess文件,放在当前网站根目录下,在.haccess文件中添加伪静态规则

    <IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
    </IfModule>

    Apache访问权限

    找到:apache文件,进入conf文件,打开httpd.conf 文件,做如下修改:

    <Directory />
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Satisfy all
    </Directory>

    修改成

    <Directory />
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
    #    Deny from all
        Allow from all

    #允许所有访问
        Satisfy all
    </Directory>

    第二处:找到并替换以下内容:

    <Directory "D:/wampserver/www/">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important. Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    # AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride all

    #
    # Controls who can get stuff from this server.
    #

    # onlineoffline tag - don't remove
    Require all granted
    </Directory>

    Apache下目录禁止访问

    在Options Indexes FollowSymLinks中删除Indexes。

            即: Options  FollowSymLinks
       【备注:Indexes的作用就是默认查找index文件,如果没有就展示目录下面所有文件,去掉就禁止访问】

        这样的话就属于整个Apache禁止目录浏览了。

        如果是在虚拟主机中,只要增加如下信息就行:
               <Directory “D:test”>
                 Options -Indexes FollowSymLinks
                 AllowOverride None
                 Order deny,allow
                 Allow from all
             </Directory>
         这样的话就禁止在test工程下进行目录浏览。

    备注: 切记莫把“Allow from all”改成 “Deny from all”,否则,整个网站都不能被打开。
       <Finished>

     还有一种方法:

    可以在根目录的 .htaccess 文件中输入

    <Files *> 
    Options -Indexes 
    </Files> 
    就可以阻止Apache 将目录结构列表出来。


    php.ini文件配置

    时间配置PRC中国

    date.timezone = PRC 


    文件上传
    file_uploads = On //支持http上传
    upload_tmp_dir = //临时文件保存路径
    upload_max_filesize = 2M //上传的大小限制
    post_max_size = 10M //post提交的大小限制
    max_file_uploads = 20 //允许一次上传的最大文件数

    XDEBUG设置,函数嵌套循环次数:

    报错内容:Fatal error: Maximum function nesting level of '100' reached, aborting!

    解决办法

    查找xdebug 找到zend_extension = “D:/wamp/bin/php/php5.3.13/zend_ext/php_xdebug-2.2.0-5.3-vc9-x86_64.dll”  这句在前面加;注视掉,在后面加上

    xdebug.max_nesting_level = 500

  • 相关阅读:
    Ad hoc access to OLE DB provider 'Microsoft.ACE.OLEDB.12.0' has been denied. You must access this provider through a linked server.
    阻塞问题:会话是sleeping的,但是open_tran 不是0
    windows Server DNS服务器配置
    内存缺页
    "ros::NodeHandle"的用法:全局vs.私有
    python 判断当前执行用户是否是 root 用户
    docker 安装及启动 postgresql 及navicat 连接
    Mac 在环境变量中隐藏密码或者密钥等信息
    磁盘空间不足导致虚拟机无法启动
    VirtuaBox 下安装 Centos8 无法上网
  • 原文地址:https://www.cnblogs.com/blueskycc/p/4743383.html
Copyright © 2011-2022 走看看