This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Problems With New Install Of Symfony2 Final

Discuss installing Symfony 2 here

Problems With New Install Of Symfony2 Final

by Fred Bloggs » Wed Aug 03, 2011 12:18 pm

Hi All,

I recently installed the final version of Symfony2 on my Ubuntu Natty Narwhal machine but I am unable to get all of its features to work. That is, if I call http://localhost/app_dev.php I can view the Welcome page as expected but if I then click on either the Configure or Demo button links I get:

Not Found
The requested URL /app_dev.php/demo/ was not found on this server.
-----------------------------------------------------------------------------------------------------
Apache/2.2.17 (Ubuntu) Server at localhost Port 80

or

Not Found
The requested URL /app_dev.php/_configurator was not found on this server.
-----------------------------------------------------------------------------------------------------
Apache/2.2.17 (Ubuntu) Server at localhost Port 80

I have managed to check the configuration by calling http://localhost/app_dev.php/config.php and the page does not report any problems. Also I have checked that Apache is OK and that mod rewrite is enabled.

Has anybody got any ideas on what I'm doing wrong or does anybody else have the same problem?

Thanks in advance,

Fred.
Fred Bloggs
Junior Member
 
Posts: 6
Joined: Wed Aug 03, 2011 11:56 am

Re: Problems With New Install Of Symfony2 Final

by bjo3rn » Wed Aug 03, 2011 6:35 pm

Hi,

try adding

RewriteBase /

to your .htaccess file.

Best regards,
Björn
User avatar
bjo3rn
Faithful Member
 
Posts: 1245
Joined: Fri Jun 17, 2011 10:03 am
Location: Germany

Re: Problems With New Install Of Symfony2 Final

by Fred Bloggs » Thu Aug 04, 2011 2:47 am

Hi Bjorn,

Thanks for your reply.

I added the RewriteBase instruction to my .htaccess file in /Symfony/web, here is what it looks like:

Code: Select all
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ app.php [QSA,L]
    RewriteBase /
</IfModule>


but the links still don't work.

Also just in case its important I include a copy of my Apache2 virtualhost/enabled sites file in /etc/apache2/sites-enabled

Code: Select all
<VirtualHost *:80>
  ServerAdmin mrfredbloggs@symfonyhost.com   
  ServerName symfonyhost
  ServerAlias symfonyhost.com www.symfonyhost.com
  DocumentRoot "/home/peter/PhpProjects/Symfony/web"
  DirectoryIndex index.php
 
  <Directory "/home/peter/PhpProjects/Symfony/web">
    Options FollowSymLinks
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>


and this is my hosts file:

Code: Select all
127.0.0.1 localhost
127.0.1.1 peter-Latitude-D820
127.0.0.1 symfonyhost

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


Note: I have called my virtualhost Symfonyhost instead of the usual localhost.

Regards,

Fred.
Fred Bloggs
Junior Member
 
Posts: 6
Joined: Wed Aug 03, 2011 11:56 am

Re: Problems With New Install Of Symfony2 Final

by xaav » Thu Aug 04, 2011 3:25 am

Try adding:


Code: Select all
RewriteCond %{REQUEST_URI} !^/app_dev.php$
RewriteCond %{REQUEST_URI} !^/app_dev.php/(.*)$


Before the RewriteRule.
xaav
Member
 
Posts: 97
Joined: Mon Jun 06, 2011 6:47 pm

Re: Problems With New Install Of Symfony2 Final

by Fred Bloggs » Thu Aug 04, 2011 3:42 am

Thanks for the reply.

Here is my modified .htacces file:

Code: Select all
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !^/app_dev.php$
    RewriteCond %{REQUEST_URI} !^/app_dev.php/(.*)$     
    RewriteRule ^(.*)$ app.php [QSA,L]
    RewriteBase /
</IfModule>


But still no luck. Maybe its not Symfony at all, since no one else seems to have reported this problem, and its something to do with Apache.

Regards,

Fred.
Fred Bloggs
Junior Member
 
Posts: 6
Joined: Wed Aug 03, 2011 11:56 am

Re: Problems With New Install Of Symfony2 Final

by bjo3rn » Thu Aug 04, 2011 8:56 am

OK, the .htaccess file doesn't seem to get parsed. My working vhost setting looks something like this:

Code: Select all
<VirtualHost *:80>
        ServerAdmin webmaster@local
        ServerName sf2.local
        DocumentRoot /var/www/Symfony/web
        <Directory /var/www/Symfony/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
        ErrorLog /var/log/apache2/sf2_error.log
        LogLevel warn
        CustomLog /var/log/apache2/sf2_access.log combined
</VirtualHost>


I don't know if it's important, but the line
Code: Select all
Order allow,deny
is missing in yours. Also, are you sure mod_rewrite is loaded (take a look at phhpinfo())?
User avatar
bjo3rn
Faithful Member
 
Posts: 1245
Joined: Fri Jun 17, 2011 10:03 am
Location: Germany

Re: Problems With New Install Of Symfony2 Final

by Fred Bloggs » Thu Aug 04, 2011 10:37 am

Thanks for reply.

Below is the latest version on my VirtualHost file:

Code: Select all
<VirtualHost *:80>
  ServerAdmin mrfredbloggs@symfonyhost.com   
  ServerName symfonyhost
  ServerAlias symfonyhost.com www.symfonyhost.com
  DocumentRoot /home/peter/PhpProjects/Symfony/web
  DirectoryIndex index.php
 
  <Directory /home/peter/PhpProjects/Symfony/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>
</VirtualHost>


And some of the output from running PhpInfo:

Code: Select all
Configuration
apache2filter

Apache Version    Apache/2.2.17 (Ubuntu)
Loaded Modules    core mod_log_config mod_logio prefork http_core mod_so mod_alias mod_auth_basic mod_authn_file mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex  mod_cgi mod_deflate mod_dir mod_env mod_mime mod_negotiation sapi_apache2 mod_reqtimeout mod_rewrite mod_setenvif mod_status


I also found a little utility on the net which can be used to check that mod rewrite is enabled on your system and its reports that it is.

Needless to say the links still don't work.

Also if I create my own bundle using:

Code: Select all
php app/console generate:bundle --namespace=MyBundle/HelloBundle --format=yml


and follow the instructions on the Symfony2 website tutorial to create and call it, that doesn't work also.

Regards,

Fred.

EDIT1: Also I have just checked and the file "rewrite.load" is in "/etc/apache2/mods_enabled"

EDIT2: I now know that .htaccess is being parsed because if I modify the file to the following:

Code: Select all
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^ http://forum.symfony-project.org/viewforum.php [R,L]
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>


I am redirected to the Symfony project forum pages and not the local Symfony Welcome page.
Fred Bloggs
Junior Member
 
Posts: 6
Joined: Wed Aug 03, 2011 11:56 am

Re: Problems With New Install Of Symfony2 Final

by Fred Bloggs » Sun Aug 07, 2011 2:39 pm

Anyone have any ideas?
Fred Bloggs
Junior Member
 
Posts: 6
Joined: Wed Aug 03, 2011 11:56 am

Re: Problems With New Install Of Symfony2 Final

by asiansexynine » Mon Aug 08, 2011 12:58 am

User avatar
asiansexynine
Member
 
Posts: 46
Joined: Wed Jun 01, 2011 3:28 am

Re: Problems With New Install Of Symfony2 Final

by dziorki » Thu Sep 29, 2011 10:50 am

I have the same problem. Somebody know how can fix it.
When i try enter http://127.0.0.1/Symfony/web/app_dev.php everything is ok
but when i add "/" in address http://127.0.0.1/Symfony/web/app_dev.php/ doesn't work and i get "The requested URL /Symfony/web/app_dev.php/ was not found on this server."
dziorki
Junior Member
 
Posts: 7
Joined: Thu Sep 29, 2011 10:48 am

Re: Problems With New Install Of Symfony2 Final

by dziorki » Thu Sep 29, 2011 1:55 pm

This is solution:
/etc/apache2/sites-available/symfony

Code: Select all
<VirtualHost *:80>
  ServerName symfony
  ServerAlias symfony.local
  DocumentRoot /var/www/Symfony/web
  DirectoryIndex index.php
  <Directory /var/www/Symfony/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>
</VirtualHost>


/etc/hosts
Code: Select all
127.0.0.1   localhost.localdomain   localhost symfony.local


And go to http://symfony.local

was it helpful?
dziorki
Junior Member
 
Posts: 7
Joined: Thu Sep 29, 2011 10:48 am

Re: Problems With New Install Of Symfony2 Final

by ivanstalyn » Fri Dec 30, 2011 9:56 pm

Hello,

I had the same problem. It is a problem with PHP and APACHE installation. For some reason (unknown to me), Symfony2 DOES NOT work with the module libapache2-mod-php5filter .

In order to solve this problem, you have to uninstall libapache2-mod-php5filter. AFter you do that, you have to install libapache2-mod-php5.

That solved my problem immediatly.

My server is UBUNTU 11.10.
ivanstalyn
Junior Member
 
Posts: 1
Joined: Fri Dec 30, 2011 9:38 pm

Re: Problems With New Install Of Symfony2 Final

by usc_bsit_ric » Tue Jun 04, 2013 11:57 am

Hi all, I have been having this problem too. And it seems that the "stock" .htaccess is the problem. I have solved this in my environment and here is my .htaccess with notes:

<IfModule mod_rewrite.c>
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] ##### this is the part that you should tweak, have the .htaccess point the request to app_dev.php, since the routing.yml is empty initially
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
RewriteRule .? %{ENV:BASE}/app_dev.php [L] ##### this is the part that you should tweak, have the .htaccess point the request to app_dev.php, since the routing.yml is empty initially
</IfModule>

<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
# When mod_rewrite is not available, we instruct a temporary redirect of
# the startpage to the front controller explicitly so that the website
# and the generated links can still be used.
RedirectMatch 302 ^/$ /app.php/
# RedirectTemp cannot be used instead
</IfModule>
</IfModule>
usc_bsit_ric
Junior Member
 
Posts: 1
Joined: Tue Jun 04, 2013 11:25 am
Location: Cebu City Philippines