Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Buscar en Ayuda

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 respuestas
  • 11 tienen este problema
  • 11 visitas
  • Última respuesta de 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.

Modificadas por vasilios el

Todas las respuestas (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.