Search code examples
php.htaccesssilexinternal-server-error

Internal error 500 with framework Silex


I'm new, and i'm french, so excuse me for my english. I'm a beginner in developement. I use at home wamp for my host, phpStorm for edit and Silex framework to do my website. On my computer it's ok, i see my page, no problem. But when I post it in OVH (online host), I have an error 500. in the beginning I don't have an .htaccess, and when I create it, I have the same problem.

Please help me. Talk with me in french if you can, or english and I will understand.

Thank's my friends


Solution

  • In many cases after installing Silex you might get 500 Error because Silex doesn't have right to write in cache folder, which it uses for f.ex. Twig. You need to add rights with using chmod

    Cache file is located under /var, so command below should help:

    In Silex root directory:

    chmod 777 -R var/
    

    Check for errors

    If you are using Apache, log files should be stored there:

    /var/log/apache2/
    

    To check what errors just occured you can look inside a file just with:

    cat error.log 
    

    It happened to me also, I've got error (which cause 500 - Internal server error):

    Uncaught exception 'RuntimeException' with message 'Unable to create the cache directory (config/../var/cache/twig/d0)

    And steps above fixed it.


    Manuals

    CHMOD [FR]

    CHMOD [EN]