Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/238.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.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
Php 在IIS7上设置laravel_Php_Mod Rewrite_Iis 7_Virtualhost_Laravel - Fatal编程技术网

Php 在IIS7上设置laravel

Php 在IIS7上设置laravel,php,mod-rewrite,iis-7,virtualhost,laravel,Php,Mod Rewrite,Iis 7,Virtualhost,Laravel,我想设置我的IIS7服务器,让它能够与用laravel(php框架)编写的web应用程序一起工作 我在CI() 但是它在laravel上不起作用(当然我删除了index.php重定向) 实际上,只有主页起作用(www.mysite.com/public) 有人在Laravel中使用/dIIS7 提前感谢我在内的根文件夹中创建了web.config文件: 导游说 现在一切都正常运行了如果您希望能够检索$\u GET变量,请不要使用: 而是使用: 检查IIS中的处理程序映射: 启动IIS 点击你

我想设置我的
IIS7
服务器,让它能够与用
laravel
(php框架)编写的web应用程序一起工作

我在
CI
()

但是它在
laravel
上不起作用(当然我删除了
index.php
重定向)

实际上,只有主页起作用(
www.mysite.com/public

有人在Laravel中使用/d
IIS7


提前感谢

我在
内的根文件夹中创建了
web.config
文件:


导游说


现在一切都正常运行了

如果您希望能够检索$\u GET变量,请不要使用:

而是使用:


检查IIS中的处理程序映射:

  • 启动IIS
  • 点击你的网站
  • 继续“处理程序映射”(在IIS块中)
  • 通过_FastCGI(xx=PHP版本)搜索路径PHP,Name=PHPxx_
  • 双击它,单击请求限制,然后单击“动词”选项卡,从中选择所有动词。这将解决它:-)

  • 我使用了下面的代码,重定向到
    index.php/{R:1}
    而不是
    public/{R:1}
    直接工作,然后没有路径更改

    <rewrite>
        <rules>
            <rule name="Imported Rule 2" stopProcessing="true">
                <match url="^(.*)$" ignoreCase="false" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                </conditions>
                <action type="Rewrite" url="index.php/{R:1}" />
            </rule>
        </rules>
    </rewrite>
    

    这是我的工作文件,有两条规则:(网站指向公用文件夹)


    经过长时间的谷歌搜索和测试,它才开始工作。以下是我的步骤:

    带有IIS 8.5的laravel5

  • 安装
  • 使用Windows平台安装程序安装php-5.6
  • 使用Windows平台安装程序安装php manager for IIS(可选)
  • 安装
    如果没有这一点,FastCgi进程(php_info()将无法工作)
  • 安装composer.exe
  • 将编写器供应商bin路径导出到路径
    设置路径=%PATH%;%USERPROFILE%\AppData\Roaming\Composer\vendor\bin
  • 运行composer global require“laravel/installer=~1.1”
  • 运行
    lavarel新应用程序
  • 在IIS中创建新的应用程序,并指向
    以下是我如何修复它的。
    打开配置文件,如果以下映射不存在,请将这些行置于

      <rewrite>
        <rules>
          <rule name="Imported Rule 1" stopProcessing="true">
            <match url="^(.*)/$" ignoreCase="false" />
            <conditions>
              <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
            </conditions>
            <action type="Redirect" redirectType="Permanent" url="/{R:1}" />
          </rule>
          <rule name="Imported Rule 2" stopProcessing="true">
            <match url="^" ignoreCase="false" />
            <conditions>
              <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
              <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php" />
          </rule>
        </rules>
      </rewrite>
    

    要在windows上安装
    IIS
    ,请转到
    控制面板->卸载程序
    ,然后按
    关闭windows功能打开/关闭
    链接,单击
    IIS
    并选择
    CGI
    选项

    从internet下载
    Web平台安装程序
    安装IIS的PHP和SQL驱动程序

    从程序添加网站打开IIS。对于公用文件夹,指向laravel/lumen项目中的
    public
    文件夹

    用于Laravel和Lumen项目。在任何可访问的文件夹中从composer创建项目。进入文件夹结构中的
    public
    文件夹并创建
    web.config
    文件,其中包含以下内容我是从laracasts获得的

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
              <rules>
                <rule name="Rule 1" stopProcessing="true">
                  <match url="^(.*)/$" ignoreCase="false" />
                  <action type="Redirect" redirectType="Permanent" url="/{R:1}" />
                </rule>
                <rule name="Rule 2" stopProcessing="true">
                  <match url="^" ignoreCase="false" />
                  <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                  </conditions>
                  <action type="Rewrite" url="index.php" />
                </rule>
              </rules>
            </rewrite>
        </system.webServer>
    </configuration> 
    

    谢谢!为我工作!此外,我还必须将index.php移动到根路径。
      <rewrite>
        <rules>
          <rule name="Imported Rule 1" stopProcessing="true">
            <match url="^(.*)/$" ignoreCase="false" />
            <conditions>
              <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
            </conditions>
            <action type="Redirect" redirectType="Permanent" url="/{R:1}" />
          </rule>
          <rule name="Imported Rule 2" stopProcessing="true">
            <match url="^" ignoreCase="false" />
            <conditions>
              <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
              <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php" />
          </rule>
        </rules>
      </rewrite>
    
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
              <rules>
                <rule name="Rule 1" stopProcessing="true">
                  <match url="^(.*)/$" ignoreCase="false" />
                  <action type="Redirect" redirectType="Permanent" url="/{R:1}" />
                </rule>
                <rule name="Rule 2" stopProcessing="true">
                  <match url="^" ignoreCase="false" />
                  <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                  </conditions>
                  <action type="Rewrite" url="index.php" />
                </rule>
              </rules>
            </rewrite>
        </system.webServer>
    </configuration>