【问题标题】:Routing Symfony 2 404 profiler debug toolbar路由 Symfony 2 404 分析器调试工具栏
【发布时间】:2016-07-01 05:57:53
【问题描述】:

在全新安装 Symfony 3 时,调试工具栏没有显示,当我有 apache 2.4.7 配置文件时:

<VirtualHost *:80>
    ServerAdmin info@enterprise.cl
    ServerName dev.enterprise.cl
    #ServerAlias www.domain.tld
    DocumentRoot /var/www/html/gestion/web
    DirectoryIndex app_dev.php

    # uncomment the following lines if you install assets as symlinks
    # or run into problems when compiling LESS/Sass/CoffeScript assets
    # <Directory /var/www/html/gestion>
    #     Options FollowSymlinks
    # </Directory>

    ErrorLog /var/log/apache2/project_error.log
    CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>

如果我将配置文件更改为:

<VirtualHost *:80>
    ServerAdmin info@enterprise.cl
    ServerName dev.enterprise.cl
    # ServerAlias www.domain.tld
    DocumentRoot /var/www/html/gestion/web
    # DirectoryIndex app_dev.php

    # uncomment the following lines if you install assets as symlinks
    # or run into problems when compiling LESS/Sass/CoffeScript assets
    # <Directory /var/www/html/gestion>
    #     Options FollowSymlinks
    # </Directory>

    ErrorLog /var/log/apache2/project_error.log
    CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>

并访问:http://dev.enterprise.cl/app_dev.php,一切正常。

怎么了?

【问题讨论】:

    标签: debugging toolbar symfony apache2.4


    【解决方案1】:

    您的 web 目录(在 apache 配置中)应该是:

    <Directory /var/www/html/gestion/web>
    

    假设“gestion”是您的 Symfony3(是 Symfony3 吗?)文件夹...

    尝试快速验证(现在的方式): http://dev.enterprise.cl/web/app_dev.php

    顺便问一下,您是否在同一主机上使用网络浏览器?如果不是,您需要像这样编辑app_dev.php 文件:

    if (isset($_SERVER['HTTP_CLIENT_IP'])
        || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
        || !(in_array(@$_SERVER['REMOTE_ADDR'], ['192.168.40.208', '192.168.255.99',
                '127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server')
    ) {
    

    其中 ['REMOTE_ADDR'] 包含您主机的 IP;默认情况下它只是 localhost (127.0.0.1)。

    【讨论】:

      【解决方案2】:

      非常感谢,解决方法是取消注释指令目录:

         <VirtualHost *:80>
              ServerAdmin info@enterprise.cl
              ServerName dev.enterprise.cl
              # ServerAlias www.domain.tld
              DocumentRoot /var/www/html/gestion/web
              # DirectoryIndex app_dev.php
      
              # uncomment the following lines if you install assets as symlinks
              # or run into problems when compiling LESS/Sass/CoffeScript assets
              <Directory /var/www/html/gestion>
                  Options FollowSymlinks
              </Directory>
      
              ErrorLog /var/log/apache2/project_error.log
              CustomLog /var/log/apache2/project_access.log combined
        </VirtualHost>
      

      Alvin,是的,我已经配置了 app_dev,可以远程访问,谢谢

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-01-19
        • 1970-01-01
        • 2018-01-17
        • 2014-07-29
        • 1970-01-01
        • 2012-02-03
        • 2014-01-30
        • 1970-01-01
        相关资源
        最近更新 更多