awslamp

Get started with Symfony

Overview

The Symfony framework is installed in the frameworks/symfony directory in the installation directory. This directory includes an example application. Application configuration files are in the conf/ directory and the main index.php file is stored in the web/ directory.

Activation and Testing

To enable the example application, edit the Apache configuration file at /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf and uncomment the following line

Include "/opt/bitnami/frameworks/symfony/conf/httpd-prefix.conf"

Then, restart the Apache server.

$ sudo /opt/bitnami/ctlscript.sh restart apache

You can now verify that the example application is working by visiting its URL using your browser at http://SERVER-IP/symfony/.

Here is an example of what you might see:

Symfony welcome page

Configuration

Before using the example application, here are a few important points to consider:

  • If your application will use a database, edit the database settings in the .env file.

    DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name"
    

    MySQL support is already available by default. If you plan to use PostgreSQL, enable the php_pdo_pgsql extension in the /opt/bitnami/php/etc/php.ini file.

    extension=php_pdo_pgsql
    
  • To move the Symfony application such that it is available at the root URL of the server (without the /symfony URL suffix), follow these steps:

    • Edit the /opt/bitnami/frameworks/symfony/conf/httpd-prefix.conf file so that it looks like this:

      DocumentRoot "/opt/bitnami/frameworks/symfony/public/"
      #Alias /symfony/ "/opt/bitnami/frameworks/symfony/public/"
      #Alias /symfony "/opt/bitnami/frameworks/symfony/public"
      Include "/opt/bitnami/frameworks/symfony/conf/httpd-app.conf"
      
    • Edit the /opt/bitnami/frameworks/symfony/conf/httpd-app.conf file and replace the AllowOverride None directive with the AllowOverride All directive:

      AllowOverride All
      
    • Restart the Apache server:

      $ sudo /opt/bitnami/ctlscript.sh restart apache
      

    You should now be able to access the example application at the root URL of your server.

More Information

Learn more about developing applications with Symfony at http://symfony.com/doc/current/.

Last modification April 8, 2020