I’ve set up a local webserver with Apache/PHP/MySQL on kubuntu to develop an web app using ZendSkeletonApplication. Document root is set to ZSA’s public folder:
<VirtualHost *>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot "/var/www/ZendSkeletonApplication/public"
<Directory /var/www/ZendSkeletonApplication/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
Within the ZSA’s public folder is an .htaccess file reading:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
Requesting http://localhost correctly retrieves the index.php. Also, mod_rewrite is working. I exchanged the last line with
RewriteRule ^.*$ test.php [NC,L]
to test that and it works.
Next, I wrote a simple “Hello World” module to get used to the architecture. Actually, I even wrote two modules following different tutorials. But whenever I try to request http://localhost/helloworld I get a 404 error
The requested URL /helloworld was not found on this server.
I double-checked the route in ZF2.
At this point I am stuck. I am a PHP developer by trade and don’t have much knowledge of server administration, so my setup is most likely to be error prone.
I’d like to ask for some directions what I might have got wrong. Are there any pitfalls coming to your mind which I could check? What else information I’d need to provide?
mod_rewrite was actually working ok, the error was in both tutorials I read.
After changing quite a few settings which I can’t recall, the 404 changed into a 500 Server Error. Only then I found a hint in the apache error log.
In both tutorials it said to create a template at view/Modulename/Index/index.phtml whereas it has to be view/modulename/index/index.phtml (note lower case names). With all lower case paths it is working for me now.
The error message from the error log (if someone happens to come across this same error):