Beginner tutorial problems[Resolved]

Hello,
I’m having troubles with setting up apache2 to work with slim. I’m actually not sure what the problem is as I’m quite green in regards to pretty much anything web related. I have been following the tutorial found here http://www.slimframework.com/docs/tutorial/first-app.html but I am stuck on setting up the configuration of apache2. I know this is only related to apache2 as ‘php -S localhost:8080’ works as per the tutorial. Running the apache2 server returns the contents of the index.php file, fx calling slimproject.dev or slimproject.dev/hello returns the contents of index.php.

Here’s my .htaccess file:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]

Here’s my apache2 virtualhost setup:

<VirtualHost *:80>
    ServerName slimproject.dev
    ServerAlias www.slimproject.dev
    ServerAdmin webmaster@localhost
    DocumentRoot "path/src/public"

    #ErrorLog ${APACHE_LOG_DIR}/error.log
    #CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory "path/src/public">
	    AllowOverride All
	    Require all granted
    </Directory>
</VirtualHost>

How was Apache installed? It sounds as if PHP might not even be enabled within Apache if you are getting the file contents back.

1 Like

Yes, that’s it! I missed that libapache2-mod-php5 wasnt installed correctly when I did it. Thanks for pointing it out to me, it works perfectly now.