1

I'm trying to run Symfony PHP application on windows using PHP inbuilt server or Apache2 server. Symfony version is 2.0.10, PHP version is 5.6.28.

When I'm using Apache server pointed to the Symfony application web directory, opening site in browser just lists directory content, instead of running the application. When I use PHP inbuilt server started at the same location ( web directory of the project folder ) opening in browser site root results in 404 resource not found error, so the Symfony application is not started. When I try to start symfony application using console command php app/console server:run, error appears, saying that server:start command doesn't exist. I couldn't make Symfony homepage to show (means to start the app). the Apache2 httpd.conf file content is:

ServerRoot "c:/Apache24"
Listen 80
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule php5_module C:/PHP/php5apache2_4.dll
<IfModule php5_module>
    DirectoryIndex index.html index.php
    AddHandler application/x-httpd-php .php
    PHPIniDir "C:/PHP"
</IfModule>
DocumentRoot "C:\projects\MySymfonyApp\web"
<Directory "C:\projects\MySymfonyApp\web">   
    DirectoryIndex app.php  
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule> 
2
  • "saying that server:start command doesn't exist" This was added in Symfony 2.6. Commented Dec 1, 2016 at 19:19
  • "opening site in browser just lists directory content," this means that your server is not configured properly. Nothing to do with Symfony. Commented Dec 1, 2016 at 19:38

2 Answers 2

1

According to https://packagist.org/packages/symfony/symfony#v2.0.10

php 5.6 is valid

Use composer to manage all your project dependencies...

To init symfony don't forget :

php app/console --env=prod cache:clear        
php app/console --env=prod cache:warmup              
php app/console --env=prod assets:install --symlink web               
php app/console --env=prod assetic:dump 

About apache/httpd prefer use yum/apt-get to manage all php modules.

Can you post your httpd error_log plz ? to be more accurate.

Sign up to request clarification or add additional context in comments.

3 Comments

the problem was that I didn't configure apache routing correctly. In the Apache httpd.conf file I has missing this section: LoadModule rewrite_module modules/mod_rewrite.so <IfModule mod_rewrite.c>
problem fixed ?
yep, after enabling and configuring mod_rewrite for routing, everything worked fine. Thanks for your suggestions, I'll use them for preparing symfony.
0

Symfony verion 2.0.10 is no longer supported. You may want to upgrade your version:

https://symfony.com/doc/current/setup.html

You can run:

composer update

to just update. Version 2.0.10 is really old, so I'm not sure if it'll work.

4 Comments

unfortunately I can't change the Symfony version, that is existing, stable system, I'm just having problems running it on locally on windows.
Can you edit your post and show the Apache configuration?
added Apache configuration. But now I moved a little bit in resolving the issue. When I request site root in the browser, it redirects me to correct location, however returns 404 not found error. for example, when I request localhost it redirects me correctly to some location, localhost/dir/myresource but Apache returns back 404 instead of sending to PHP to process. Probably apache routing is not working or not configured. How can I fix that? The Apache routing configuration, to send all requests to process by PHP symfony?
okay, after enabling routing module in apache httpd.conf file everything worked fine! LoadModule rewrite_module modules/mod_rewrite.so <IfModule mod_rewrite.c>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.