Symfony 3.1:请求app_dev.php或app.php时出错 [英] Symfony 3.1: error when requesting app_dev.php or app.php
问题描述
我在请求sorial/app_dev.php
时得到了这个信息:
Im getting this when requesting sorial/app_dev.php
:
Not Found
The requested URL /app_dev.php/ was not found on this server.
当请求sorial/app.php
时:
unregister(); $ apcLoader-> register(true); */$内核=新 AppKernel('prod',false); $ kernel-> loadClassCache();//$ kernel = new AppCache($ kernel);//使用HttpCache时,您需要调用 您的前端控制器中的方法,而不是依赖于 配置参数 //Request :: enableHttpMethodParameterOverride(); $ request = Request :: createFromGlobals(); $ response = $ kernel-> handle($ request); $ response-> send(); $ kernel-> terminate($ request,$ response);
unregister(); $apcLoader->register(true); */ $kernel = new AppKernel('prod', false); $kernel->loadClassCache(); //$kernel = new AppCache($kernel); // When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter //Request::enableHttpMethodParameterOverride(); $request = Request::createFromGlobals(); $response = $kernel->handle($request); $response->send(); $kernel->terminate($request, $response);
我在Ubuntu 14.04和Apache 2.4上
Im on Ubuntu 14.04 and Apache 2.4
编辑:这是我的虚拟主机:
This is my virtual host:
<VirtualHost *:80>
ServerName sorial
#ServerAlias sorial.es
DocumentRoot /var/www/sorial/web
DirectoryIndex app.php
#SetEnv SYMFONY__DATABASE__PASSWORD jander
<Directory /var/www/sorial/web/>
# Options Indexes FollowSymLinks MultiViews
AllowOverride All
#Order allow,deny
#allow from all
Require all granted
FallbackResource /index.php
# BEGIN EXPIRES
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 10 days"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/plain "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType application/x-icon "access plus 1 year"
</IfModule>
# END EXPIRES
</Directory>
</VirtualHost>
我的文档根目录位于/var/www/sorial/web
.
事实是,我的其他网站也遇到相同的问题.当我尝试使用a2dismod env
禁用/启用env_mod
时,问题开始了,因为添加变量SetEnv
(如您在虚拟主机中所见)时,我得到了
The truth is I have the same problem for the rest of my sites. The problem started when I try to disable/enable env_mod
using a2dismod env
, since when adding the variable SetEnv
(as you can see in my virtual host) I was getting
apache2.service的作业失败,因为控制进程退出 错误代码.请参阅"systemctl status apache2.service"和"journalctl -xe"以获取详细信息.
Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.
重新启动apache时.
when restarting apache.
推荐答案
我终于解决了我的问题,安装了php5和libapache2-mod-php5,如下所示:sudo apt-get install php5 libapache2-mod-php5
I finally solved my problem installing php5 and libapache2-mod-php5 like this: sudo apt-get install php5 libapache2-mod-php5
这篇关于Symfony 3.1:请求app_dev.php或app.php时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!