This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Firefox is having problems with php

  • 3 replies
  • 11 have this problem
  • 1 view
  • Last reply by wuergler

more options

Firefox 3.6.13 LAMP Server with PHP4

Hello, I have coded a website that contains php to delete a file. Here is my code:

if(file_exists('uploads/file.txt')){ if(!unlink('uploads/file.txt')){ $error = "ERROR: Could not delete file! Please try again or remove manually."; }else{ $error = "Successfully deleted file."; } }else{ $error = "ERROR: Could not find file! Please try again or remove manually."; }

As you can see, the code checks to see if the file exists, and if it does, it deletes the file or shows an error message if it can't. If it can't find the file, it shows the file not found error message. If I execute this script in IE, it will always work flawlessly, deleting the file and displaying the correct error message.

In Firefox, once in a while, I will get the "file not found" error message, but the file still gets deleted from the server. This is impossible with the way the script is written, as the file would never get deleted if that error gets displayed or vice versa.

The way the error is displayed is I have another line later in the page like this:

if($error){echo "<font color="red">$error</font>
";}

I can reproduce it easily in FF but never in IE or other browsers.

Firefox 3.6.13 LAMP Server with PHP4 Hello, I have coded a website that contains php to delete a file. Here is my code: if(file_exists('uploads/file.txt')){ if(!unlink('uploads/file.txt')){ $error = "ERROR: Could not delete file! Please try again or remove manually."; }else{ $error = "Successfully deleted file."; } }else{ $error = "ERROR: Could not find file! Please try again or remove manually."; } As you can see, the code checks to see if the file exists, and if it does, it deletes the file or shows an error message if it can't. If it can't find the file, it shows the file not found error message. If I execute this script in IE, it will always work flawlessly, deleting the file and displaying the correct error message. In Firefox, once in a while, I will get the "file not found" error message, but the file still gets deleted from the server. This is impossible with the way the script is written, as the file would never get deleted if that error gets displayed or vice versa. The way the error is displayed is I have another line later in the page like this: if($error){echo "<b><font color='red'>$error</font></b><br>";} I can reproduce it easily in FF but never in IE or other browsers.

Modified by vasilios

All Replies (3)

more options

Interesting ... just a wild guess: could this be related to how FF does caching? If so, deleting cache before executing the script or perhaps reloading would probably not produce the error.

more options

I thought so, too, in re: caching. But the error never should have come up in the first place. Also, I can upload and delete the file over and over again. Most of the time the successful message is shown, sometimes the unsuccesful message is shown. Each time, the file gets deleted.

I've also set browser.cache.check_doc_frequency to 1 to try and recreate IE's "every visit to this page" setting, and deleted my cache. The error eventually comes back.

Let's just say that the error should never be seen unless someone goes in there and manually deletes the file via FTP or something, which is why it was added in the first place. The file is (normally) always there. It's almost like FF is ignoring the if/else and just running through it in sequence: checking if the file is there, deleting the file, and then maybe setting $error until it gets to the last one.

more options

Since PHP is normally executed on the server, unless you have some sort of "embedded" PHP, I still don't think that the browser can react directly on code, other than some different behaviour in caching or ... what else? It's strange, anyway.