Develop applications PHP & MySQL

Hello everyone. I am new to PHP and this forum and looking for help with my first PHP project.
I read the book “Develop applications PHP & MySQL” di Tom Butler, but I can’t get the examples to work on apache due to routing errors. Being a beginner I cannot modify the code to adapt it to Apache, indeed I would like to use this adaptation to understand in detail the code of the php routing part in the book. I would like to use the Ninja framework to develop the first dynamic website in PHP and start gaining development experience.
Thanks to those who want to help me.
Gabriele.

PS: sorry for my English

Can you help @TomB ?

I think you are misunderstanding… his book “Novice to Ninja” isn’t some framework called “Ninja” but he means Beginner to Expert (Ninja just a slang for “expert” in English).

Most PHP is run on Apache. You have very little customization needed in Apache to get it to work with PHP (basically just add a few lines to your httpd.conf file to get it to recognize PHP files and pass them to the PHP program where you have it installed).

I am also not sure what you mean by routing unless you mean exactly those lines I was talking about in httpd.conf.

But I would follow the instructions the author gives about setting up your environment in the first few chapters so that you can easily follow along. If you have done that and have the problems, then perhaps give us a summary of what they are telling you to do and we can see where you might be going wrong.

:slight_smile:

As the server I get you to set up in the book uses NIGNX, you will need some rewrite rules for the routing to work on Apache, though the relevant rewrite rules and how to set them up on Apache is covered in the “URL Rewriting” section:

https://www.sitepoint.com/premium/books/php-mysql-novice-to-ninja-6th-edition/read/9/jz3rvo5p?fromShare=true

First of all congratulations and thanks for the books and for the reply. I could not try any example project for the url rewrite problem … now it works and I can try to study the code of the examples and try to do my first project in PHP OOP.
Thank you very much, also for the other answers … surely I will ask you again for help later, the road is long :smile:
Gabriele.

2 Likes

Sorry if I immediately return to the problem of the php router, but I have not yet understood how it works and I have some malfunctions.
(I added the entry "‘phpmysql6 / public / index.php’ to the JdbRoutes.php to make it work)
The site runs on xampp inside the subfolder phpmysql6 (localhost / phpmysql6) I would like to know:

  1. the string to indicate in .htaccess is: RewriteRule ^. * /Phpmysql6/public/index.php [NC, L, QSA] or RewriteRule ^. * /Public/index.php [NC, L, QSA]
  2. Should the links of the menu hrefs (layout.html.php) include the site name “phpmysql6” or not (href = “phpmysql6 / joke / list”)?
    I hope I was clear and to receive your help, next step enable the registered user from the email and implement password recovery).
    Thank you very much, bye.