PHP Mysql 6th edition

I am at the point in the book that they talk about apache2 rewrites. I think I have done all that the book tells me but I can not get it to work.
Is there anyone that could help me with this ?

I did figure out something. I have not set up a fully qualified domain name as I am just using the machine as a development machine and don’t want the outside to see it . I now realize that I must do this for the rewrite module to work. How do I set up a FQDN for a development machine with a fixed address ?

Apache2 Rewrites work OK on a local computer but it is essential to have certain Apache2 modules installed and after their installation it is also necessary to reload Apache2:

From memory

a2enmod rewrite 
systemctl reload apache2

Please check the correct name of the module, etc

Tapped on a tablet.

I did that but I think the problem is on my development machine I did not create a FQDN for the machine as I don’t know how to do that for a development machine that will not service the internet only my local net.

Have you checked the error log files ?

yes I have checked the error logs. that is where I saw some things and now I think the problem is that I don’t have my development machine with a FQDN and I don’t know how to do that. Don’t want the machine on the internet only on my local area net.

I think the http://localhost/ is a FQDN on my local Linux Operating System which is set when I install Apache2. Perhaps another user could confirm my beliefs?

Pretty URLs work OK on my localhost setup.

Have you tried http://localhost/index.php?about

Are there any errors or warning in the error log files and what is the http_response_code()?

Isn’t it just a case of editing your hosts file and pointing an appropriate name to

1 Like

Yes, this, and then refer to that hostname in your Apache config.

Ok almost have it but I am on my own machine and not the homestead. I am getting an error and the system is not redirecting properly.
here is the last two errors:
[Mon Feb 14 16:38:17.581187 2022] [php7:warn] [pid 3619] [client] PHP Warning: include(/var/www/html/lessons6/website/CMSController/templates): failed to open stream: Operation now in progress in /var/www/html/lessons6/website/CMSController/public/index.php on line 6, referer: http://development/lessons6/website/CMSController/
[Mon Feb 14 16:38:17.581211 2022] [php7:warn] [pid 3619] [client] PHP Warning: include(): Failed opening ‘/var/www/html/lessons6/website/CMSController/public/…/templates/’ for inclusion (include_path=’.:/usr/share/php’) in /var/www/html/lessons6/website/CMSController/public/index.php on line 6, referer: http://development/lessons6/website/CMSController/
just a little more help

Ok I gave up on trying to get my server to rewrite properly and now I have the Vagrant homestead up and running but when I go to the public folder on the site I get a message saying no input file specified ?? what is up with this ?

It means PHP-FPM can’t find the file NGiNX is telling it to render.

I installed my own server again and followed the apache2 mod_rewrite instructions and now I get the index.php and when I try the list or add the url does change but !!!

Ok I got that fixed. Now the index.php show up but when I try the list or add I do get /public/index.php?route=joke/list but the joke controller is not loaded. I sure could use some advice on how to debug this problem. Thanks

I have been testing and found that the code in the CMSRedirect code section does function but when I put the code in CMS Controller the code does not work. Only the layout page shows without any text no matter what I do.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.