1

I'm following through the getting started skeleton app tutorial on the Zend homepage:

http://framework.zend.com/manual/2.2/en/user-guide/skeleton-application.html

I've got as far as being able to enter into the browser address bar "zf2-tutorial.localhost/" and my Zend welcome page should appear. It doesn't, the apache web folder (/var/www) directory appears instead. If I enter "http://zf2-tutorial.localhost/1234" to test whether the Zend 404 page appears, it doesn't. The default apache Not Found page appears.

I created my app by running in terminal:

php composer.phar create-project --repository-url="http://packages.zendframework.com" zendframework/skeleton-application:dev-master /var/www/zf2-tutorial

.. this created all the files in the desired folder (/var/www/zf2-tutorial).

I then created the file /etc/apache2/sites-enabled/zf2-tutorial with the following:

<VirtualHost *:80>
         ServerName zf2-tutorial.localhost
         DocumentRoot /var/www/zf2-tutorial/public
         SetEnv APPLICATION_ENV "development"
         <Directory /var/www/zf2-tutorial/public>
                 DirectoryIndex index.php
                 AllowOverride All 
                 Order allow,deny
                 Allow from all
         </Directory>
</VirtualHost>

I updated my /etc/hosts file with:

127.0.0.1               zf2-tutorial.localhost localhost

I restarted apache

sudo service apache2 restart

.. and by this point I should be able to see the Zend welcome page so I can proceed with the rest of the tutorial but nothing.

By the way, I'm using Ubuntu 12.04, Apache/2.4.9 (Ubuntu) and PHP 5.5.14.

Is there anything obvious that I've missed out? I've got a feeling that it has something to do with the mod_rewrites but I'm a little confused which I should be updated and how. Any help would be much appreciated.

doydoy44
  • 5,720
  • 4
  • 29
  • 45
Martyn
  • 6,031
  • 12
  • 55
  • 121

2 Answers2

4

Add the

<VirtualHost *:80>
    [... same code ....]
</VirtualHost>

in the /etc/apache2/sites-enabled/000-default file and restart the apache2


Update -

If it still doesn't work then try the below command and check -

sudo a2enmod rewrite

sudo service apache2 restart

This will enable the rewrite module if not already is.

After entering the URL in the browser, if the required page is not displayed then check the apache error log file located at /var/log/apache2/error.log

By this, you could get some idea as where its going wrong.

Kunal Dethe
  • 1,254
  • 1
  • 18
  • 38
  • 1
    Tried, no joy. Seems earlier I'd forgotten to use a2ensite when it was a separate file and also had to change the zf2-tutorial file to zf2-tutorial.conf file. That didn't help either. Looking at the HTTP request header also I can confirm that there is a "Host zf2-tutorial.localhost", apache should pick on this no? – Martyn Jul 07 '14 at 15:07
  • Please check the `Update` added to the above answer. Please let us know the result. – Kunal Dethe Jul 08 '14 at 07:09
  • Damn. It works now. I tried your initial suggestion again, and it worked. So, I took the zf2-tutoril VirtualHost out of 000-default.conf and put it back into zf2-tutorial.conf, enabled it and restarted apache. Now it works, I don't know why. I guess that I wasn't enabling sites properly. Thanks a lot for your help. – Martyn Jul 08 '14 at 08:21
1

Your problem was in config file name. In directory sites-enabled files should have .conf in the end of name.

  • Good: zf2-tutorial.conf
  • Bad: zf2-tutorial
Lariat
  • 167
  • 2
  • 11