Symfony 3.1: error requesting app_dev.php or app.php

I get this when I request sorial/app_dev.php :

 Not Found The requested URL /app_dev.php/ was not found on this server. 

And at the request of sorial/app.php :

unregistered(); $ ApcLoader-> register (true); * / $ kernel = new AppKernel ('prod', false); $ Kernel-> loadClassCache (); // $ kernel = new AppCache ($ kernel); // When using HttpCache, you must 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);

Im on Ubuntu 14.04 and Apache 2.4

EDIT: 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> 

And my document root is in /var/www/sorial/web .

True, 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 I added the SetEnv variable (as you can see on my virtual host) I got

The operation for apache2.service failed because the management process failed with an error code. See "Systemctl apache2.service status" and "journalctl -xe" for details.

when restarting apache.

+5
source share
4 answers

Finally solved my problem by installing php5 and libapache2-mod-php5 as follows: sudo apt-get install php5 libapache2-mod-php5

+4
source

Finally, I solved the problem of installing php5 and libapache2-mod-php5 as follows: sudo apt-get install php5 libapache2-mod-php5 - @ziiweb

The error you received is usually caused by missing or corrupt configuration files.

The operation for apache2.service failed because the management process failed with an error code. See "Systemctl status apache2.service" and "journalctl -xe" for details.

You can use the journalctl command for more information.

 $ journalctl | tail AH00526: Syntax error on line 5 of /etc/apache2/sites-enabled/mydomain-wsf.lan.conf 

You can also run the Apache configuration test.

 $ apachectl configtest Syntax OK $ sed -i 's/SetEnv/SetEnvFoobar/' /etc/apache2/sites-enabled/test.conf $ apachectl configtest AH00526: Syntax error on line 12 of /etc/apache2/sites-enabled/test.conf: Invalid command 'SetEnvFoobar', perhaps misspelled or defined by a module not included in the server configuration Action 'configtest' failed. The Apache error log may have more information. 

The apachectl graceful also very useful. It restarts Apache, but first runs configuretest "before starting the restart, to make sure Apache is not dying.

apachectl graceful

Gracefully restarts the Apache httpd daemon. If the daemon is not running, it starts. This differs from a normal restart in that currently open connections are not interrupted. A side effect is that old log files will not be closed immediately. This means that if used to rotate the log of a script, a significant delay may be required to ensure that old log files are closed before being processed. This command automatically checks the configuration files as in configtest before starting the restart to make sure Apache is not dying. This is equivalent to apachectl -k graceful

- Apache Docs

Reinstalling the software may work as it fixes any missing configuration files.

 $ apt-get install --resinstall libapache2-mod-php5 php5 

Another alternative mentioned here is to clean and then install. It is very important to know that purge is a destructive command, meaning that it will delete all existing configuration files. This is pretty much the equivalent of a new installation.

 $ apt-get purge libapache2-mod-php5 php5 $ apt-get install libapache2-mod-php5 php5 
+2
source

Ok, I had the same issue as Debian with apache server. Try replacing .htaccess inside the website and clear the cache.

 DirectoryIndex app.php <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ RewriteRule ^(.*) - [E=BASE:%1] RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteRule ^app_dev.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] RewriteCond %{REQUEST_FILENAME} -f RewriteRule .? - [L] RewriteRule .? %{ENV:BASE}/app_dev.php [L] 

And that should be your virtual host

 <VirtualHost *:80> ServerName sorial DocumentRoot /var/www/sorial/web <Directory /var/www/sorial/web> AllowOverride All Order Allow,Deny Allow from All </Directory> ErrorLog /var/log/apache2/project_error.log CustomLog /var/log/apache2/project_access.log combined </VirtualHost> 
+1
source

Actually, in my configuration I use .htaccess files, and I see that you commented out the "Parameters" line. I wonder if you have a reason for this?

If not, I would suggest uncommenting it like this:

 <Directory /var/www/sorial/web/> Options Indexes FollowSymLinks MultiViews 

See if this works.

+1
source

Source: https://habr.com/ru/post/1257874/


All Articles