Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
XAMPP conf-根据默认值运行php5_模块&;根据.htaccess切换到其他php cgi版本_Php_.htaccess_Configuration_Xampp_Version - Fatal编程技术网

XAMPP conf-根据默认值运行php5_模块&;根据.htaccess切换到其他php cgi版本

XAMPP conf-根据默认值运行php5_模块&;根据.htaccess切换到其他php cgi版本,php,.htaccess,configuration,xampp,version,Php,.htaccess,Configuration,Xampp,Version,对于较旧的项目,我需要将php版本切换到.htacces。如果我只使用PHPCGI版本,它工作得很好。php作为模块具有更好的性能。现在我想配置我的xampp,以按照默认值运行php5_模块,并使用AddHandler。。。在htaccss中切换到其他cgi版本的php。如何做到这一点?谢谢你的帮助 xampp配置: # # XAMPP settings # <IfModule env_module> SetEnv MIBDIRS "/xampplite/php/extra

对于较旧的项目,我需要将php版本切换到.htacces。如果我只使用PHPCGI版本,它工作得很好。php作为模块具有更好的性能。现在我想配置我的xampp,以按照默认值运行php5_模块,并使用AddHandler。。。在htaccss中切换到其他cgi版本的php。如何做到这一点?谢谢你的帮助

xampp配置:

#
# XAMPP settings
#

<IfModule env_module>
    SetEnv MIBDIRS "/xampplite/php/extras/mibs"
    SetEnv MYSQL_HOME "\\xampplite\\mysql\\bin"
    SetEnv OPENSSL_CONF "/xampplite/apache/bin/openssl.cnf"
    SetEnv PHP_PEAR_SYSCONF_DIR "\\xampplite\\php"
    SetEnv PHPRC "\\xampplite\\php"
    SetEnv TMP "\\xampplite\\tmp"
    UnsetEnv PERL5LIB
</IfModule>

#
# PHP-Module setup
#
#LoadFile "/xampplite/php/php5ts.dll"
#LoadModule php5_module modules/php5apache2_2.dll

<IfModule php5_module>

    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>

    PHPINIDir "/xampplite/php"
</IfModule>


#
# multible PHP Version Setup
#


#SetHandler application/x-httpd-php4
<IfModule !php5_module>

  Action application/x-httpd-php4_3 "/php4_3/php.exe"
  AddType application/x-httpd-php4_3 .php4 .php

  Action application/x-httpd-php4_4 "/php4_4/php.exe"
  AddType application/x-httpd-php4_4 .php4 .php

  Action application/x-httpd-php5_4 "/php5_4/php.exe"
  AddType application/x-httpd-php5_4 .php5 .php  

  Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
  AddType application/x-httpd-php-cgi .php  

  <FilesMatch "\.php$">
      AddHandler application/x-httpd-php-cgi .php
#        SetHandler application/x-httpd-php-cgi
  </FilesMatch>

</IfModule>

ScriptAlias /php4_3/ "/xampplite/php4_3/"
<Directory "/xampplite/php4_3">
  AllowOverride None
  Options None
  Order allow,deny
  Allow from all
</Directory>

ScriptAlias /php4_4/ "/xampplite/php4_4/"
<Directory "/xampplite/php4_4">
  AllowOverride None
  Options None
  Order allow,deny
  Allow from all
</Directory>

ScriptAlias /php5_4/ "/xampplite/php5_4/"
<Directory "/xampplite/php5_4">
  AllowOverride None
  Options None
  Order allow,deny
  Allow from all
</Directory>



#
# PHP-CGI setup
#

#<IfModule !php5_module>
#    <FilesMatch "\.php$">
#        AddHandler application/x-httpd-php-cgi .php
#        SetHandler application/x-httpd-php-cgi
#    </FilesMatch>
#    <IfModule actions_module>
#        Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
#    </IfModule>
#</IfModule>

<IfModule mime_module>
    AddType text/html .php .phps
</IfModule>

ScriptAlias /php-cgi/ "/xampplite/php/"
<Directory "/xampplite/php">
    AllowOverride None
    Options None
    Order deny,allow
    Deny from all
    <Files "php-cgi.exe">
        Allow from all
    </Files>
</Directory>

<Directory "/xampplite/cgi-bin">
    <FilesMatch "\.php$">
        SetHandler cgi-script
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler None
    </FilesMatch>
</Directory>

<Directory "/_projects/xampp">
    <IfModule php5_module>
        <Files "status.php">
            php_admin_flag safe_mode off
        </Files>
    </IfModule>
    AllowOverride AuthConfig
</Directory>


<IfModule alias_module>
    Alias /security "/xampplite/security/htdocs/"
    <Directory "/xampplite/security/htdocs">
        <IfModule php5_module>
            <Files "xamppsecurity.php">
                php_admin_flag safe_mode off
            </Files>
        </IfModule>
        AllowOverride AuthConfig
   </Directory>

    Alias /licenses "/xampplite/licenses/"
    <Directory "/xampplite/licenses">
        Options +Indexes
        <IfModule autoindex_color_module>
            DirectoryIndexTextColor  "#000000"
            DirectoryIndexBGColor "#f8e8a0"
            DirectoryIndexLinkColor "#bb3902"
            DirectoryIndexVLinkColor "#bb3902"
            DirectoryIndexALinkColor "#bb3902"
        </IfModule>
   </Directory>

    Alias /phpmyadmin "/xampplite/phpMyAdmin/"
    <Directory "/xampplite/phpMyAdmin">
        AllowOverride AuthConfig
    </Directory>

    Alias /webalizer "/xampplite/webalizer/"
    <Directory "/xampplite/webalizer">
        <IfModule php5_module>
            <Files "webalizer.php">
                php_admin_flag safe_mode off
            </Files>
        </IfModule>
        AllowOverride AuthConfig
    </Directory>
</IfModule>


#
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
    Order deny,allow
    Deny from all
    Allow from ::1 127.0.0.0/8 \
               fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \
               fe80::/10 169.254.0.0/16

    ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
</LocationMatch>

我找到了自己的解决方案:

xampp形态

#
# XAMPP settings
#

<IfModule env_module>
    SetEnv MIBDIRS "/xampplite/php/extras/mibs"
    SetEnv MYSQL_HOME "\\xampplite\\mysql\\bin"
    SetEnv OPENSSL_CONF "/xampplite/apache/bin/openssl.cnf"
    SetEnv PHP_PEAR_SYSCONF_DIR "\\xampplite\\php"
    SetEnv PHPRC "\\xampplite\\php"
    SetEnv TMP "\\xampplite\\tmp"
    UnsetEnv PERL5LIB
</IfModule>

#
# PHP-Module setup (module as default version 5.3 in my case)
#

LoadFile "/xampplite/php/php5ts.dll"
LoadModule php5_module modules/php5apache2_2.dll

<IfModule php5_module>
    <FilesMatch "\.php$">
        AddHandler application/x-httpd-php .php
        #SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
    PHPINIDir "/xampplite/php"
</IfModule>


#
# PHP-CGI multiple Version Setup
#

Action application/x-httpd-php4_3 "/php4_3/php.exe"
AddType application/x-httpd-php4_3 .php4 .php

Action application/x-httpd-php4_4 "/php4_4/php.exe"
AddType application/x-httpd-php4_4 .php4 .php

Action application/x-httpd-php5_4 "/php5_4/php-cgi.exe"
AddType application/x-httpd-php5_4 .php5 .php  

Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
AddType application/x-httpd-php-cgi .php  

<IfModule mime_module>
    AddType text/html .php .phps
</IfModule>

ScriptAlias /php4_3/ "/xampplite/php4_3/"
<Directory "/xampplite/php4_3">
  AllowOverride None
  Options None
  Order allow,deny
  Allow from all
</Directory>

ScriptAlias /php4_4/ "/xampplite/php4_4/"
<Directory "/xampplite/php4_4">
  AllowOverride None
  Options None
  Order allow,deny
  Allow from all
  SetEnv PHPRC "\\xampplite\\php4_4"
</Directory>

ScriptAlias /php5_4/ "/xampplite/php5_4/"
<Directory "/xampplite/php5_4">
  AllowOverride None
  Options None
  Order allow,deny
  Allow from all
  SetEnv PHP_PEAR_SYSCONF_DIR "\\xampplite\\php5_4"
  SetEnv PHPRC "\\xampplite\\php5_4"
</Directory>

ScriptAlias /php-cgi/ "/xampplite/php/"
<Directory "/xampplite/php">
    AllowOverride None
    Options None
    Order deny,allow
    Deny from all
    <Files "php-cgi.exe">
        Allow from all
    </Files>
</Directory>

<Directory "/xampplite/cgi-bin">
    <FilesMatch "\.php$">
        SetHandler cgi-script
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler None
    </FilesMatch>
</Directory>

<Directory "/_projects/xampp">
    <IfModule php5_module>
        <Files "status.php">
            php_admin_flag safe_mode off
        </Files>
    </IfModule>
    AllowOverride AuthConfig
</Directory>


<IfModule alias_module>
    Alias /security "/xampplite/security/htdocs/"
    <Directory "/xampplite/security/htdocs">
        <IfModule php5_module>
            <Files "xamppsecurity.php">
                php_admin_flag safe_mode off
            </Files>
        </IfModule>
        AllowOverride AuthConfig
   </Directory>

    Alias /licenses "/xampplite/licenses/"
    <Directory "/xampplite/licenses">
        Options +Indexes
        <IfModule autoindex_color_module>
            DirectoryIndexTextColor  "#000000"
            DirectoryIndexBGColor "#f8e8a0"
            DirectoryIndexLinkColor "#bb3902"
            DirectoryIndexVLinkColor "#bb3902"
            DirectoryIndexALinkColor "#bb3902"
        </IfModule>
   </Directory>

    Alias /phpmyadmin "/xampplite/phpMyAdmin/"
    <Directory "/xampplite/phpMyAdmin">
        AllowOverride AuthConfig
    </Directory>

    Alias /webalizer "/xampplite/webalizer/"
    <Directory "/xampplite/webalizer">
        <IfModule php5_module>
            <Files "webalizer.php">
                php_admin_flag safe_mode off
            </Files>
        </IfModule>
        AllowOverride AuthConfig
    </Directory>
</IfModule>


#
# New XAMPP security concept
#

<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
    Order deny,allow
    Deny from all
    Allow from ::1 127.0.0.0/8 \
               fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \
               fe80::/10 169.254.0.0/16

    ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
</LocationMatch>
#
# XAMPP settings
#

<IfModule env_module>
    SetEnv MIBDIRS "/xampplite/php/extras/mibs"
    SetEnv MYSQL_HOME "\\xampplite\\mysql\\bin"
    SetEnv OPENSSL_CONF "/xampplite/apache/bin/openssl.cnf"
    SetEnv PHP_PEAR_SYSCONF_DIR "\\xampplite\\php"
    SetEnv PHPRC "\\xampplite\\php"
    SetEnv TMP "\\xampplite\\tmp"
    UnsetEnv PERL5LIB
</IfModule>

#
# PHP-Module setup (module as default version 5.3 in my case)
#

LoadFile "/xampplite/php/php5ts.dll"
LoadModule php5_module modules/php5apache2_2.dll

<IfModule php5_module>
    <FilesMatch "\.php$">
        AddHandler application/x-httpd-php .php
        #SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
    PHPINIDir "/xampplite/php"
</IfModule>


#
# PHP-CGI multiple Version Setup
#

Action application/x-httpd-php4_3 "/php4_3/php.exe"
AddType application/x-httpd-php4_3 .php4 .php

Action application/x-httpd-php4_4 "/php4_4/php.exe"
AddType application/x-httpd-php4_4 .php4 .php

Action application/x-httpd-php5_4 "/php5_4/php-cgi.exe"
AddType application/x-httpd-php5_4 .php5 .php  

Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
AddType application/x-httpd-php-cgi .php  

<IfModule mime_module>
    AddType text/html .php .phps
</IfModule>

ScriptAlias /php4_3/ "/xampplite/php4_3/"
<Directory "/xampplite/php4_3">
  AllowOverride None
  Options None
  Order allow,deny
  Allow from all
</Directory>

ScriptAlias /php4_4/ "/xampplite/php4_4/"
<Directory "/xampplite/php4_4">
  AllowOverride None
  Options None
  Order allow,deny
  Allow from all
  SetEnv PHPRC "\\xampplite\\php4_4"
</Directory>

ScriptAlias /php5_4/ "/xampplite/php5_4/"
<Directory "/xampplite/php5_4">
  AllowOverride None
  Options None
  Order allow,deny
  Allow from all
  SetEnv PHP_PEAR_SYSCONF_DIR "\\xampplite\\php5_4"
  SetEnv PHPRC "\\xampplite\\php5_4"
</Directory>

ScriptAlias /php-cgi/ "/xampplite/php/"
<Directory "/xampplite/php">
    AllowOverride None
    Options None
    Order deny,allow
    Deny from all
    <Files "php-cgi.exe">
        Allow from all
    </Files>
</Directory>

<Directory "/xampplite/cgi-bin">
    <FilesMatch "\.php$">
        SetHandler cgi-script
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler None
    </FilesMatch>
</Directory>

<Directory "/_projects/xampp">
    <IfModule php5_module>
        <Files "status.php">
            php_admin_flag safe_mode off
        </Files>
    </IfModule>
    AllowOverride AuthConfig
</Directory>


<IfModule alias_module>
    Alias /security "/xampplite/security/htdocs/"
    <Directory "/xampplite/security/htdocs">
        <IfModule php5_module>
            <Files "xamppsecurity.php">
                php_admin_flag safe_mode off
            </Files>
        </IfModule>
        AllowOverride AuthConfig
   </Directory>

    Alias /licenses "/xampplite/licenses/"
    <Directory "/xampplite/licenses">
        Options +Indexes
        <IfModule autoindex_color_module>
            DirectoryIndexTextColor  "#000000"
            DirectoryIndexBGColor "#f8e8a0"
            DirectoryIndexLinkColor "#bb3902"
            DirectoryIndexVLinkColor "#bb3902"
            DirectoryIndexALinkColor "#bb3902"
        </IfModule>
   </Directory>

    Alias /phpmyadmin "/xampplite/phpMyAdmin/"
    <Directory "/xampplite/phpMyAdmin">
        AllowOverride AuthConfig
    </Directory>

    Alias /webalizer "/xampplite/webalizer/"
    <Directory "/xampplite/webalizer">
        <IfModule php5_module>
            <Files "webalizer.php">
                php_admin_flag safe_mode off
            </Files>
        </IfModule>
        AllowOverride AuthConfig
    </Directory>
</IfModule>


#
# New XAMPP security concept
#

<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
    Order deny,allow
    Deny from all
    Allow from ::1 127.0.0.0/8 \
               fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \
               fe80::/10 169.254.0.0/16

    ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
</LocationMatch>
#SetHandler application/x-httpd-php4_3
#SetHandler application/x-httpd-php4_4
SetHandler application/x-httpd-php5_4