r/PHPhelp • • Feb 03 '25

PHP help

In my file, everything was working. I would open the folder and it would bring me to the login file. I couldn't go anywhere else without logging in. Then, I changed the name of the index.php to login.php since it was the login file. There is no other file with that shares the name login.php. I also updated the name of it in all of the old files as well, and it won't work. But when I ran a test and changed the names back to what they were before it started to work again. Can anyone help me out with this? I'm new to PHP and my classmates are no help for the upcoming project and I'm doing it alone.

1 Upvotes

14 comments sorted by

View all comments

Show parent comment

1

u/MateusAzevedo Feb 03 '25 edited Feb 03 '25

That video doesn't tell anything about the issue, I wasn't even able to tell what was wrong.

If you aren't a developer and know nothing about coding, then your girlfriend needs to come here and she should explain what she did.

Edit: I just watched part 2. The issue is exactly what u/dabenu said.

When the file is named index.php, the webserver will execute it automatically when the URL does not specify a file, example http://localhost/. That's why in the second video the login form shows up. The reason the other page doesn't work, as far as I can tell, is because she tried an invalid URL, but I can't be sure.

In the first video, the reason the browser shows the folder listing is because there's no index.php anymore and that is the expected behavior.

If anything that I said here makes any sense to her, then there isn't anything else I can do without further information.