Symfony3 on ISPConfig3.1 : install and issues

Discussion in 'General' started by jbonlinea, Nov 22, 2016.

  1. jbonlinea

    jbonlinea Member

    Dear all,
    I'm totally new to symfony and a beginer in server set-up, I did quite a huge research but excuse me if the answer is obvious or was just in front of me.
    I know my post is terribly long, but organised fo quick reading, and it reflect how much effort I’ve put into this, so please be kind :)
    I'll really apprecite your help

    I installed and want to use the symfony demo they provide
    in dev, everything works smoothly (see below)
    in prod
    • the twig template code area is empty in all the pages,
    • the blog page will show a blank page after two or three visits (actually it seems to be time related not number of visit related)
    However every other pages are, and continue to be displayed properly (apparently at least)
    I've done quite a few testings and it seems that there might be a symlink issue, and/or permission issue, and or a cache issue (every time i empty the cache, the blog page is properly displayed and become blanck after few visits)


    once the server is configured (the server is distant, cf. MY CONFIG for details)
    symfony installation without composer
    - followed :
    —> everything was smooth​

    installing the demo ( being a vhost created for testing purpose)
    - cd /var/www/
    - symfony demo
    —> console returns successfully installed

    test the requirements (following :
    - php bin/symfony_requirements
    —> Your system is ready to run Symfony projects
    —> Optional recommendations : intl ICU version installed on your system is outdated (55.1) and does not match the ICU data bundled with Symfony (57.1)​

    edit the /web/config.php file to add my IP and run the script (I'm working on a distant server via ssh/ftp/ and so on)
    —> same result as above​

    ——Everything seems ok ——

    ——First navigation : ——
    go to
    - looks cool
    - after few clicks,
    —> return a blank page
    after two or three visit of, where ever I reach there from, it returns a black page. However every other pages are, and continue to be displayed properly (apparently at least)

    —> in firebug, the network tab returns an « 500 internal server error », but agin the page displayed is blank, firebug report :
    Connection close
    Content-Length 0
    Content-Type text/html; charset=UTF-8
    Date Tue, 22 Nov 2016 18:14:09 GMT
    Server Apache/2.4.18 (Ubuntu)
    Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Encoding gzip, deflate
    Accept-Language fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
    Connection keep-alive
    Cookie PHPSESSID=l9276sd3eh94u90hhdi0mv9rl2
    Upgrade-Insecure-Requests 1
    User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:50.0) Gecko/20100101 Firefox/50.0
    —> Apache vhost log

    —> Symfony logs
    I have no prod.log
    I have a dev.log, containing this kind of lines :
    • [2016-11-22 19:38:49] request.INFO: Matched route "{route}". {"route":"_wdt","route_parameters":{"_controller":"web_profiler.controller.profiler:toolbarAction","token":"eb7d27","_route":"_wdt"},"request_uri":"","method":"GET"} []
    • [2016-11-22 19:38:49] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
    Last edited: Nov 22, 2016
  2. jbonlinea

    jbonlinea Member

    —> MY CONFIG
    - ubuntu 16.04 LTS, Apache 2.4, PHP 7 in Fast-CGI mode ; all is up to date
    - ISPConfig 3.1 (up to date auto install script) ; the demo has its own vhost for testing
    (the last point may be where the permissions issues comes form, but that's not so clear)

    —> server configuration
    - followed :
    —> used the minimum configuration, but took into account that
    - having apache 2.4 involves to replace Order Allow,Deny by Require all granted
    - php-cgi needs RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] to operate​

    —>in ISPConfig,
    - the vhost folder is symlinked thus
    /var/www/ -> /var/www/clients/client1/web3/

    - the default .conf file of my vhost contains both
    <Directory /var/www/>

    <Directory /var/www/clients/client1/web3/web>

    Each filled with the same directives

    Thus, in IPSConf -> web domain (vhost) -> option -> apache directive, I added the directive provided for the minimum configuration
    <Directory /var/www/>
      AllowOverride All
      Require all granted
      Allow from All
    <Directory /var/www/clients/client1/web3/web>
      AllowOverride All
      Require all granted
      Allow from All
    <Directory /var/www/>
      Options FollowSymlinks
    <Directory /var/www/clients/client1/web3/>
      Options FollowSymlinks
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    - restart apache
    —> server return a error 403 if I try to access to
    —> apache has taken my directives into account​

    back to the demo (cache cleared)
    —> same as in first navigation​

    By default the .conf contain some directive about which I have two remarks :
    - some option are preceded by a + ; since I’ve read that if an option had a + or a -, then all the option should have a + or -
    —> I thus added a + before the FollowSymlinks requested by the minimum configuration
    - the default .conf already contained Option +FollowSymlinks however for the directories var/www/ and /var/www/clients/client1/web3/web ; Note, the web folder is included in the /var/www/ and the /var/www/clients/client1/web3/
    —> I thus removed the Option +FollowSymlink affecting the web directory in the default .conf​

    - restart apache
    back to the demo (cache cleared)
    —> same as in first navigation​

    Moreover, ISPConfig recreate the .conf file as it is by default when changed from the ssh terminal
    - I thus tried without the Option +FollowSymlinks specified for the upper level (/var/www/ and /var/www/clients/client1/web3/)
    —> but no changes​

    I’ve also played with the directive to avoir duplicates between ISPConfig default directives and the required ones by the minimum configuration
    All together the issue remain and the logs stay the same

    I tried to rename the .htaccess file situated in and go to :
    —> I’m not redirected towards app.php
    —> the blog page is blank after two three visits
    However I haven’t tried the optimized configuration that disable .htacces since it requires
    <Directory /var/www/>
    AllowOverride None

    which is opposed to the default ISPConfig directive
    <Directory /var/www/>
    AllowOverride All

    well it works smoothly !
    I’ve read that in dev environment the cache was rebuilt at every request, that’s one thing that took me on the way to cache…
    but remember I had two issues, first /web/en/blog/ returned a black pages after the second or third call, but wile the "twig template code" area is empty in all the pages in prod mode, in dev mode it’s displayed like a charm !

    I can play with the toolbar and access to /web/app_dev.php/profiler
    There are no missing messages

    - changing $kernel = new AppKernel('prod', false); to $kernel = new AppKernel('prod', true); in /web/app.php
    —> Solved one of the two issues
    —> the "twig template code" area is filled​
    —> the blog page remain blank after two or three visits and the vhost log remain the same :
    —> [Tue Nov 22 20:09:57.194561 2016] [fcgid:warn] [pid 5972] [client] mod_fcgid: stderr: PHP Fatal error: Cannot declare class Symfony\\Component\\HttpFoundation\\Response, because the name is already in use in /var/www/clients/client1/web3/web/symfony_demo/var/cache/prod/classes.php on line 3745, referer:

    emptying the cache in the console
    php bin/console cache:clear --env=prod
    php bin/console cache:clear --env=dev

    —> [OK] …

    back to the demo
    —> same as in first navigation
    I’ve also tried to remove the caches the hard way (rm -rf)


    First try (logged in as root via ssh) :
    - HTTPDUSER=`ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
    - setfacl -R -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var
    - setfacl -dR -m u:"$HTTPDUSER":rwX -m u:`whoami`:rwX var
    - ls -l
    —> drwxrwxr-x+ 5 web3 client1 4096 nov. 13 21:36 var
    —> there is a + so the ACL are properly set up​

    Second try (logged in as root via ssh) :
    - uncomment umask(0000); in /bin/console and in /web/app_dev.php
    - add umask(0000); in /web/app.php right after (two test, one at a time) :
    - <?php
    - use Symfony\Component\HttpFoundation\Request;

    Third try
    - chmod 777 /var
    - chmod 777 /var/cache
    - chmod 777 /var/logs

    - chmod 777 /web

    Trying all the above one by one, two by two, all together, while rebooting apache and the server and clearing cache at every step

    - clearing cache
    - re-testing the requirement
    —> Ok, same result as above​

    As I started to get mad I tried
    - chmod -R 777 /var/www/
    —> but hell, still not solved
    Wonder if there are really any permission issues, maybe not !

    —>PHP CONFIG—>
    PDO-SQLite PHP extension
    —> enabled (v 3.11.0), as required by the symfony_demo according to symfony_demo/​

    —> as defined by ISPConfig, URL of the symfony demo : /var/www/​
    —> should not be an issue


    Oh you're still here ?! me too ! I'm so stuck !
    spend my day reading tuto, docs, and post
    must have a way to run synfomy3 on ISPConfig3.1

    You rock
    Last edited: Nov 22, 2016

Share This Page