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

Help a newbie: PhpStorm Vs Symfony Vs manual PHP install

Discuss installing Symfony 2 here

Help a newbie: PhpStorm Vs Symfony Vs manual PHP install

by sound_man » Wed Mar 12, 2014 1:58 pm

Hi Everyone,

I'm new to Symfony and have been trying to get through the Symfony Quick Tour (http://symfony.com/doc/current/quick_to ... cture.html) in order to get a handle on things, but I'm coming up against some problems.

First to explain my setup:
  • Developing on Windows 7
  • PHP 5.3.23 (manually installed)
  • Apache 2.4 (manually installed)
  • Using PhpStorm 7.1.3

So I have Apache and PHP working fine and I have successfully created the Quick Tour project both via the command line and via PhpStorm. Here's where I ran into problems.


I'm obviously missing something here, but I'm at a loss to find out what and I'm not quite familiar with the terminology to properly Google up the issue.

Does Symfony just not like it if it's not in the web root?
sound_man
Junior Member
 
Posts: 3
Joined: Wed Mar 12, 2014 1:07 pm

Re: Help a newbie: PhpStorm Vs Symfony Vs manual PHP install

by nymo » Thu Mar 13, 2014 10:25 am

Hi,
check your apache httpd.conf. There you can set the port where apache should listen to. Search for this line:

Code: Select all
Listen 80


Change it to 8000 and then apache should be running on :8000. But why not leaving it on 80?

Then check if you have activated the mod_rewrite module in your apache config. That could be the reason while this url is not working http://localhost/test-symfony/demo/hello/sound_man.

Look for:
Code: Select all
LoadModule rewrite_module modules/mod_rewrite.so


After that restart apache. If this is working I would suggest to configure some virtual hosts in your apache config this makes developing with symfony easier especially if you have some side projects.
nymo
Senior Member
 
Posts: 174
Joined: Fri Jan 07, 2011 11:37 pm
Location: Germany

Re: Help a newbie: PhpStorm Vs Symfony Vs manual PHP install

by sound_man » Thu Mar 13, 2014 11:26 am

Hi nymo,

Thanks for helping.

I'm perfectly happy with port 80. The only reason I mentioned 8000 was because it was part of the Quick Tour instructions and I was wondering if it had some sort of special significance. No need to worry about this though.

As for mod_rewrite, I did indeed have to activate it. However, it appears that .htaccess is not detecting this activation despite multiple apache restarts.

I also checked this on another Symfony project that I have (developed by someone else in my company on a Mac and is the reason why I'm trying to learn Symfony now) and the .htaccess there also doesn't realise that I have activated mod_rewrite.

As a workaround, I managed to get routing working by introducing a rule outside of the IfModule checking for mod_rewrite, i.e.:

Code: Select all
DirectoryIndex app_dev.php

<IfModule mod_rewrite.c>
....
</IfModule>


While that change is fine to assist me in playing around with the Quick Tour project, I can't go making the same change on the other one I mentioned, so I need to get mod_rewrite recognised.

Any suggestions?
sound_man
Junior Member
 
Posts: 3
Joined: Wed Mar 12, 2014 1:07 pm

Re: Help a newbie: PhpStorm Vs Symfony Vs manual PHP install

by nymo » Fri Mar 14, 2014 10:06 am

In order to get .htaccess files working you need to check you <Directory> Settings in the httpd.conf file. Since you're currently not working with vhosts you should have one <Directory> area for your document root. There is a setting called AllowOverride. By default it is set to none. If you want to use .htaccess files you need to change it to all for example or define a special directive like FileInfo or something else (http://httpd.apache.org/docs/2.2/howto/htaccess.html)

Here is an example how it looks like on my machine:

Code: Select all
<Directory "c:/dev/sites">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>
nymo
Senior Member
 
Posts: 174
Joined: Fri Jan 07, 2011 11:37 pm
Location: Germany

Re: Help a newbie: PhpStorm Vs Symfony Vs manual PHP install

by sound_man » Fri Mar 14, 2014 11:11 am

I had set that a while ago to no effect unfortunately.

In the end, I set up something in httpd-vhosts.conf to point at the root web directory of the Symfony project and that seemed to resolve the issue for me, e.g.
Code: Select all
<VirtualHost *:80>
   DocumentRoot "C:/apache24/htdocs/project/Mobile Portal/Website/"
   ServerName test.project.dev
</VirtualHost>


I'm guessing that "AllowOverride All" didn't work as the directory was set to my apache root (C:/apache24/htdocs/), not the root of the Symfony project.

In any case, I seem to be up and running now. Thanks for the help :thumbup: :)~:-)~:smile: .
sound_man
Junior Member
 
Posts: 3
Joined: Wed Mar 12, 2014 1:07 pm

Re: Help a newbie: PhpStorm Vs Symfony Vs manual PHP install

by nymo » Mon Mar 17, 2014 10:11 am

I'm glad it is working now for you. For your information AllowOverRide rules are also working in a vhost environment. Maybe you will need it someday :)
nymo
Senior Member
 
Posts: 174
Joined: Fri Jan 07, 2011 11:37 pm
Location: Germany

Re: Help a newbie: PhpStorm Vs Symfony Vs manual PHP install

by codelobster » Fri Jan 16, 2015 4:16 pm

Also I suggest to use Codelobster
It has special Symfony autocomplete
codelobster
Junior Member
 
Posts: 8
Joined: Thu Mar 24, 2011 2:58 pm