路由 Symfony 2 404 分析器调试工具栏
Routing Symfony 2 404 profiler debug toolbar
在 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,一切正常。
怎么了?
您的网站目录(在 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).
非常感谢,解决方案是取消注释指令目录:
<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,可以远程访问,谢谢
在 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,一切正常。
怎么了?
您的网站目录(在 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).
非常感谢,解决方案是取消注释指令目录:
<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,可以远程访问,谢谢