Hi, Tom.
Thank you VERY much for getting back to me.
FIRST POINT
I have removed ALL files from www.framework.local
, the virtual host AND I’ve removed all files from var/www/html (the default apache content folder).
I already had the .htaccess file but I have copied this into both directories AND I’ve created an index.php with the code you suggested (plus a bit to differentiate the two folders… you’ll see) and saved that into each folder.
In Chrome:
-
URL “
www.framework.local
” outputs: “At /var/www/www.framework.local, you are viewing /” -
URL “www.framework.local/foo/bar” outputs: “Not Found
The requested URL /foo/bar was not found on this server.
Apache/2.4.25 (Debian) Server atwww.framework.local
Port 80” -
URL “localhost” produces: “At /var/www/html, you are viewing /”
-
URL “localhost/foo/bar” produces: “Not Found
The requested URL /foo/bar was not found on this server.
Apache/2.4.25 (Debian) Server at localhost Port 80” -
Running “tail -n 200 /var/log/apache2/error.log” after this shows data but nothing to do with the Page Not Founds. Virtually nothing in there to be honest.
I think we CAN say from this that the .htaccess file is NOT redirecting File Not Founds to index.php. But why?
POINT TWO
I have PHP 7 installed on my dev machine so there’s nothing stopping the code from running. I am just targetting the 5.6 methods/syntax where necessary as my IDE only supports 5.6. Thus far, that has only been the lack of the Null Coalescing Operator. All other code thus far has been run through a version checker I use and is proven to run perfectly in 5.6 anyway. So, it’s not that that is causing problems.
With respect, I understand that you can’t cater for every possible setup but I think it’s a bit unfair to say: “I can only guarantee the code will work if you use Windows with VirtualBox and Vagrant and the Homestead VM.”
This is seriously specific and, honestly, if it had said that on the book cover I would never have bought it.
People have spent £25 or more on your book, have devoted weeks of time to following through it. Not everyone has or wants your very specific setup.
My set up is not bizarre. Just standard Debian 9 packaged versions of Apache2, PHP7 and MariaDB10. And this is exactly what is running on the production server I pay for. ISP’s wouldn’t touch an environment like yours as they are reputed to be insecure: Homestead, XAMPP, no. They run environments like mine.
So I do not accept that a book which says it teaches PHP and MySQL should provide code which does not run on a bog standard Debian 9 installation.
I think you have a responsibility, while as I say not covering every setup possible, to cover basic ones like a straight Debian/Ubuntu install or a straight Fedora install. Just an appendix which says: "If you choose to work in a more “regular” environment such as Debian’s or Fedora’s certified stable packages (an environment which more closely matches what you’ll find on a production server), then you need to make the following few alterations to your setup for the code in the book to work. Don’t you?
Any further help you can offer me will be greatly appreciated so that I can benefit from the generic framework the book promises.
Thanks in advance.
Mike