PHP MySQL novice to ninja 6th edition

Hi, oluwa.

There is nothing at all wrong with Tom’s code (I have read the book from beginning to end and the code works fine).

What’s going wrong is that Tom has used Vagrant which is a COMPLETE environment. So its not just the code we are working with; it’s the code and how it interacts with the web server. And it’s this half we need to look at. I have not used Vagrant and I’ve had a few we server related changes I’ve had to make in order to get the code working (not the fault of the code; my fault for not using Vagrant). Here is what might be going wrong for you

You SHOULD have your index.php file inside a folder called public but then you need to set up a VirtualHost and, in your DocumentRoot setting have something like:

 DocumentRoot /var/www/www.<chosendomainname>.local/public

…see the use of public at the end.

I’ve had other changes to make as well.

Have a look at this thread and if there are still aspects you don’t understand, let me know and I’ll walk you through it:

https://www.sitepoint.com/community/t/url-rewriting-php-mysql-novice-to-ninja/290945