Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


"Page not found" error, but the page exists!

Posted on 2011-09-14
Medium Priority
Last Modified: 2013-12-13
We have a website that was working perfectly fine yesterday, but for some reason one of the pages are returning a "page not found" error today. The php page does exist and I've not made any coding changes. I've contacted the webhost and they contend that no changes were made to the linux server. So i'm stumped, what reasons could there be for a 404 error when nothing seemingly has changed?

As a bit of background, our site is used for collecting and reporting KPIs. On one page users enter comments that will later be included in a generated PDF document.  This page's "Save" button calls a processing page ("save_individual_kpis_comments.php") to enter the comments into a database. It is at this point where the processing page is suddenly throwing a "page not found" error. As I've already said, nothing has changed on the coding side and I can see that this function was used yesterday to enter records into the relevant table. Funnily when I retry or type the URL into the browser  it does seem to run the PHP code and attempts to close the page after processing, however nothing is actually entered into the database.

I'm not the programmer who setup this website and my php knowledge is limited so trouble shooting has been difficult. Could anyone point me in the right direction here?
Question by:Silent_Killer
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
  • +4
LVL 10

Expert Comment

ID: 36538788
A couple of things to try:
-Try re-uploading the file to your server and specify "ascii" as the file transfer type.
-Check the permissions and the owner of the file on your linux server.

-Check to make sure the submission form is sending to the correct file.
( NOTE: some linux systems are case sensitive so the file name & path referred to by the submission form should match the exact relative the path to the destination )

Expert Comment

ID: 36539240
If you don't know much abt it, maybe just duplicate a working php file in the same folder.
And edit its contents by pasting the contents from the file that looks like is missing.
Then rename the not-working-file to something unique.
And rename the duplicated file you pasted the code in to the correct name.

This way you won't have to upload anything or play with permissions or transfer types ;)
LVL 13

Expert Comment

by:Hugh McCurdy
ID: 36540472
If neither of the above posts led to a solution, it would be helpful to know the O/S - Linux, Unix, Windows, something else?

Having said all that, my first suspect is a permissions problem as Stu pointed out.  Specifically, be sure that the file can be read by the web server software.  Compare the permissions of the PHP file in question with other PHP files in the same folder.  

If it's Linux or Unix, I would make sure that you haven't lost a symbolic link.  I don't know if your programmer used symbolic links, but I do.   (This is why I want to know the O/S.  There's little point in me offering Linux/Unix ideas if the server is Windows).

Another place I'd look, which I'll grant will be difficult for you, is the code itself.  It's possible (I don't think likely) but possible that the page is attempting to load a different page (than the page you expect) and the second page is the page that actually is missing or has incorrect permissions.


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


Author Comment

ID: 36542350
To hmccurdy: It's Linux, symbolic links sound interesting and they may have been used, if you can give me an example of one, maybe?

We're using a webhosting company called WebHosting UK and have a shared Linux box with them. My thought is that it must be something on the server environment that has changed (upgrade of PHP version, some server variable change, ??) that is causing the problem and maybe we just need to rerun some "indexing" service to remap the site. I'm hesitant to start messing with the code 1stly because I'm not a proficient PHP programmer and secondly because the code was working fine on Tuesday and then this error yesterday without me having touched a thing on that site.

The webhost maintains nothing has changed. Now before I get into a (heated) debate with them about this, do you guys agree that it must be a server issue and not a coding one?

Thanks for all the posts by the way I'm definately going to check out the permissions suggestions, although again, I don't know who would have messed with it in the first place.

Many thanks for the help!
LVL 13

Expert Comment

by:Hugh McCurdy
ID: 36542426
Without knowing what all the software does, I can't be sure.  I think it's more likely that something happened on the computer.  However, I question if the web host has the capability to solve the problem even if it is their fault.

One thing to do, if you have shell access to the computer, is see when it was last booted.  The w command will give up the up time.  

$ w
08:19:16 up 2 days, 21:03,  6 users,  load average: 0.20, 0.24, 0.18

If it was rebooted between working and not working, then I think it's very likely it's a server problem.

Best I can do without seeing the code and that amount of work is likely beyond the role of EE.  (I suppose Ray could disagree but I'll let him do that if he does.)

Expert Comment

ID: 36542440
It sounds to me that you don't have ssh access and just have a hosting account.
If this is the case the only thing you quickly can do yourself is either upload the broken file again or what I suggeted earlier using either a ftp program or a web control panel.

if you do however have ssh access, u could run the following commands:
(assuming the code in your broken file is still correct)
assuming broken filename = broken.php
assuming a working filename = index.php
assuming you managed to cd into your folder

mv broken.php broken.old.php
cp index.php broken.php
cat broken.old.php > broken.php

It just creates a new broken.php file with the correct contents, and the same permissions as a working file.

I wouldn't waste energy on yelling at your host abt this. It could be anything, from bad disk sector to something else.
Just fix it yourself and have a smile back on ur face asap ;)
LVL 13

Expert Comment

by:Hugh McCurdy
ID: 36542868
Side comment related to Duboux's comment.  Years ago, we had the company website on a shared computer.  In this case, I did have ssh access and they included a regular Linux development env.  I could write CGI's in C.  (Years ago, I said.)  At one point, the compiler libraries became corrupted.  Clearly, without root access, nothing I could have done.  The ISP had no idea the library files were corrupted or how it happened.  But they were.  

They didn't know how to fix it and by then I stopped caring because we just happened to be migrating to a new server (that we controlled).  

Just saying lots of things can happen and the ISP doesn't necessarily have any idea it happened or why it happened or how to fix it.
LVL 111

Expert Comment

by:Ray Paseur
ID: 36542997
Do you have a copy of phpinfo() output from the old days when everything was working?  You might want to compare that to phpinfo() today.  Look for things like magic quotes and register globals.  The default settings for these may have been changed.

You might also want to look at the build date for the PHP installation to see if it is very recent.  Just a thought... ~Ray

Expert Comment

ID: 36554815
Why don't you fire up a html index page just to prove you're still talking with the server.

Author Comment

ID: 36904277
Hi guys,

I've tried all your suggestions and created a new page from one that was working and just containing the phpinfo() statement to see if it can at least run that, however it still comes up with the "file not found" error. When I manually enter the URL the PHP info is displayed (unfortunately I don't have an older output to compare it againsts), so the problem is not with the content of the file. I've also checked the permissions and they are the same as all other executing scripts.

Could the problem be in the POST method from the calling page?
//<form method="post" action="save_report_comments.php" target="_blank">

This seems impossible to troubleshoot seeing as I can't even get it to go to a new page to display the values that are being posted.

Thanks for all the help and suggestions so far. If I can't get it fixed this week, I'll hire a freelance programmer and let you know the outcome.
LVL 13

Expert Comment

by:Hugh McCurdy
ID: 36904763
While I'm confident that I could solve this, I nominate Ray (not that you are taking nominations) as the freelance programmer.

Expert Comment

ID: 36916264
has the php software on your server been updated ?

anyway, that <form> line you posted wants to open the save_report_comments.php file which must be in the same directory.

maybe you can test a little, by changing the action to another page.
perhaps to a new page, that only has the following code: <?php echo "hi"; ?>
Then test by sumbitting that form, and see if u see the word "hi" on a blank page..
If so, then either:
- your save_report_comments.php file doesn't exist in the same folder
- your save_report_comments.php has no read-access for everyone
- your save_report_comments.php has a different ownership (maybe root or apache or w/e)
- there's a .htaccess file messing up your save_report_comments.php from showing

Expert Comment

ID: 36935078
Have you checked .htaccess file. Is there any redirection set?

Accepted Solution

Silent_Killer earned 0 total points
ID: 37069619
Thanks for all comments & help to sort this issue.

- Redirection was correct.
- Htaccess was set properly
- URL was called correctly
- The form was posting to the correct php file.

After a lot of searching and tests the issue was found to be appearing whenever an = data was in the form POST. The HTTP POST that happens URL encodes all entries and then there is an additional encoding for =. This should be fine on most servers & server hosts BUT our host had the mod_security rule for the domain which threw an apache warning and diverted the page to 404.

This warning has been suppressed and the error is resolved. This was an error at apache level and the POST entry never got to the PHP level itself. Issue will only arise if you have set mod_security with warnings to show 404 page.

Following was the error in question.
[Wed Oct 19 10:48:07 2011] [client] ModSecurity: Access denied with code 406 (phase 2). Invalid UTF-8 encoding: invalid byte value in character at ARGS:previous_138. [offset "431"] [file "/usr/local/apache/conf/modsec2.user.conf"] [line "23"] [id "950801"] [msg "UTF8 Encoding Abuse Attack Attempt"] [severity "WARNING"] [hostname ""] [uri "/phpfile.php"] [unique_id "Tp6c11wwbgUAADDaFO8AAAA3"]

Author Closing Comment

ID: 37092838
Solution provided by external consultant.

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question