I got this error in my PHP file this morning and I am unable to apply any style to page and anything I add in my HTML file will not show up on the web page.
Does anyone know what this error means?
As it says there, a “404” error means that the file you are trying to access is not found. On the right it tells you which line of which source file is throwing the error, I believe, though I’m not certain on that.
Here’s a list of those HTTP codes and their meanings: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
Hi @ubulade78 and a warm welcome to the forum.
The error states that files cannot be found which is probably due to incorrect relative paths from the current file.
What I usually do is to find the exact path the current file is located and then examine the relative path of the file which is giving the not 404 error.
<?php
echo '<p>Path of current file: ' .getdir() .'</p>';
Edit:
It is usually a lot easier if you show the contents of the problem file and users can try the file on their own computers. Also if it is possible to show an online web-page.
Hi John, there is no getdir() function in Php so that must be a custom function. For clarification, to get the full path of a file you just need this…
echo dirname(__FILE__);
Whoops - I meant echo getcwd(); // get current working directory
Alternatives:
echo getcwd();
echo '<br>';
echo __dir__;
echo '<br>';
echo dirname(__FILE__);
echo '<br>';
OMG Thank you so much guys, i finally figured it out. I had three diffrent CSS file that were not in the folder linked to the html. It was right right there and i didn’t even notice.
OMG Thank you so much, i finally figured it out. I had three diffrent CSS file that were not in the folder linked to the html. It was right right there and i didn’t even notice.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.