Encountering 403 Forbidden Error while Accessing a Website (PHP)
Hi everyone,
I recently encountered an issue while trying to access a website, and I'm hoping to get some guidance on how to resolve it. Whenever I attempt to access the URL https://labo-iii-production.up.railway.app/php/ej01_base/, I receive a "403 Forbidden" error message.
Just to provide some context, I'm working with PHP on my local development environment. From my understanding, the "403 Forbidden" error indicates that the server is denying access to the requested resource. I've checked my internet connection and confirmed that it's stable, so the issue seems to be related to server-side configurations or permissions.
I've already tried a few troubleshooting steps such as clearing my browser cache, cookies, and trying to access the website from different devices and networks, but I still receive the same error.
As I'm working with PHP, I'm curious to know if there are any specific PHP-related configurations that could be causing this "403 Forbidden" error. Are there any PHP directives, file permissions, or server settings that I should be aware of? I would appreciate any insights or suggestions on how to overcome this issue.
Thank you in advance for your help!
16 Replies
Project ID:
18ede837-1467-4bc7-ad49-4f97a199984d
is your php code inside an /app directory?
No
well put the code inside an /app folder then lol
Yes, my PHP code is inside the /app directory. However, it is still not functioning correctly. I found a user on Stack Overflow who had the same issue, so it seems to be a PHP or Railway-specific problem.
https://es.stackoverflow.com/questions/586368/error-al-desplegar-un-simple-hola-mundo-en-php-en-railway-app
Thank you for the help anyway, and if you happen to come across a solution, I would appreciate it if you could let me know as well.
Stack Overflow en español
Error al desplegar un simple Hola mundo en php en Railway.app
Estoy tratando de desplegar un simple Hola mundo escrito en html dentro de un php en un proyecto de Railway.app
El file es index.php y solo contiene codigo html
<h1>Hola mundo </h1>
U...
as you can see from this link, when you setup your project structure correctly you do not get a 403
https://test-service2.up.railway.app/
both you and the person from stack overflow have incorrectly setup the project structure, this is not a railway problem
I have set up my project structure correctly following the recommended guidelines. Here is a screenshot showcasing my project structure:
If possible, could you please share the repository with me so that I can further investigate the issue? Your assistance would be greatly appreciated. Thank you in advance.
I don't have a repo for that test site, it was deployed locally with
railway up
though that wouldn't make any difference
you share your repo with me, and I'll tell you if I see anything wrongThank you, now I'll share it with you.
It's a project for school, that's why the project structure looks like this. I know it's not the correct way to do it, and maybe that's where the error comes from, but well, that's how my teacher requested it. Here is the repository: https://github.com/ramatc/labo-iii
GitHub
GitHub - ramatc/labo-iii: Ejercicios de Laboratorio III - UTNFRH
Ejercicios de Laboratorio III - UTNFRH. Contribute to ramatc/labo-iii development by creating an account on GitHub.
The problem lies within the php folder, clearly.
like i said above, the problem is the incorrect project structure, and that is indeed the case
if your teacher will not accept anything else, it can be made to work if absolutely required
this is without modifying any structure what so ever, but i am modifying configs
https://test-service2.up.railway.app/
place these two files in your project folder root and it should work
Now, yes! I really appreciate the time you took to help me solve it! Thank you so much. Regards.
no problem!
the only drawback of serving files from the project root is that anything in the project root can be served too, for example https://labo-iii-production.up.railway.app/railway.json
but neiher of those files i provided contain anything remotely secretive, so i dont see it as an issue for your use case