VerySimple Dev Blog

iPhone - This message has not been downloaded from the server

[Update - I switched to IMAP instead of POP for connecting to my email server and it seems much better.  It also marks messages as "read" on the phone once I read them on my computer, which was a previously major annoyance.  I would recommend IMAP if it's available to you.]

I have my iPhone set to retrieve email messages from my POP3 account. This works great except that about every 10th message would show “This message has not been downloaded from the server” instead of the message text.

I discovered that this was not actually a problem with the iPhone, rather with my email setup. I also have Outlook on my desktop which is configured to remove messages from the server after downloading. What happens is that the iPhone downloads the headers but does not get the full message body until you actually read the message. Meanwhile, Outlook downloads all new messages and immediately removes them from the server. So when you try to read an email on the iPhone for the first time, it only has the headers and needs to retrieve the message body from the server. However if Outlook was opened then it probably removed the messages from the server. So there is no way for the iPhone to get the message body. It would make more sense if the error message on the iPhone was changed to “This message is no longer available on the server.”

There is a fairly simple work-around to this problem. Just configure your desktop email client so it doesn’t immediately remove messages after downloading. In my case using Outlook, there is a setting to leave mail on the server for X days (I set mine to 3 days). This resolved the issue for me entirely, however if I try to read an email on the iPhone that is more than 3 days old it won’t be available. Basically the number of days you configure your client to retain messages on the server is how far back they will be available via your iPhone. For me 3 days is plenty. However, if you want to have access to older messages you can set the retention to 30 days or whatever your email client and host will allow.

PHP on Windows 2003 IIS 6 Displays 404 Page Not Found

After Installing PHP 5 using the Windows installer on Windows 2003 you may find that IIS displays a “Page Not Found” 404 error for every .php page. This is a perplexing error because is it not actually a real 404 error. The file is really there, but IIS is unable to process it based on how the installer configures the extension mapping. Instead of providing any useful information or even a 500 error; however, IIS throws out a 404.

Steps to Fix the Problem:

Before you troubleshoot further, you may want to read #5 about how the Application Pool effects PHP configuration changes.

1. Replace the old DOS format path to the PHP Executable with a full path w/ quotes
2. Move php.ini to C:\Windows
3. Edit php.ini to set cgi.force_redirect = 0 (only necessary for CGI mode)
4. Make sure php-cgi.exe and/or phpisapi.dll are included in Web Service Extensions
5. Recycle the Application Pool

1. Replace the old DOS Path Format

Edit Map

The default path to PHP is C:\Program Files\PHP. When creating the IIS extention mapping, the PHP Installer uses the old DOS format path to the PHP ISAPI or CGI executable such as “C:\PROGRA~1\PHP\PHP5IS~1.DLL”. IIS does not seem to like this format.

One simple solution for this is to simply reinstall PHP to C:\PHP, or another location that doesn’t use long filenames. This will generally save you a lot of grief as PHP and its installer do not seem to handle windows long file names consistently.

If you prefer to keep things in Program files, go to the IIS Extension Mapping screen and locate the value for “.php” (See screenshot above). Click the browse button, select the executable and put quotes around it the entire path. So the value for this field should look like this “C:\Program Files\PHP\php5isapi.dll” (WITH the quotes around it). If you have installed PHP in CGI mode instead, the file name would be php-cgi.exe instead of php5isapi.dll

While you’re at it you may want to check the box for “Verify that file exists” as well. This allows IIS to handle actual missing pages (ie broken links) and return a 404. Otherwise IIS will just pass the request to PHP without verifying the .php file really exists and PHP throws a CGI error when the file isn’t found. People seem to have inconsistent results with this setting.

If you recycle the app pool at this point (see step #4) you *may* solve the 404 error depending on what extensions you installed or whether you had re-run the installer and changed stuff. However, you may still have issues changing php.ini settings in which case keep reading.

2. Copy php.ini to C:\Windows

The PHP installer creates a php.ini file for you based on your selections in the setup process. However the installer saves the file in C:\Program Files\PHP. The problem is that PHP is looking in C:\Windows for the .ini file. So, you need to move the file php.ini to C:\Windows. This may be confusing because PHP seems to run fine. But if you look closely at the phpinfo() output, you may find that php.ini file is not being loaded and all default settings are being used.

One of the critical things when configuring PHP is to actually edit the .ini file that is being used by PHP. The installer creates a worthless file in a location that PHP won’t read and so you may waste a lot of time editing this file. PHP pretty much universally will check the Windows folder for php.ini on all varieties of Windows, so my advice is to use that location and delete any other php.ini files that are hanging around..

3. Set cgi.force_redirect = 0 (Only necessary for CGI mode)

Various people report that you need to edit php.ini and set:

cgi.force_redirect = 0

I haven’t noticed this setting having any effect on my installations, but many people claim it is necessary when you are running PGP in CGI mode. This setting will have no effect if you are running in ISAPI mode.

4. Make sure php-cgi.exe and/or phpisapi.dll are enabled in Web Service Extensions

In IIS Manager, click on “Web Service Extensions” This includes a list of all dll and exe files that IIS is allowed to execute. The extension mapping that is specified for .php files must also be added here. I prefer to just add both php-cgi.exe as well as php5isapi.dll here and enable them both so that if I don’t need to worry about it again.

If the handler is already in the list, make sure that it is “enabled” as well. The enabled services have a green overlay on the service icon.

Lastly, confirm that the file path is exactly the same here as it is in your .php extension mapping configuration. That includes the dos path formatting. If you use junctions, you need to be using the same path in both places. IIS seems to check the path rather than the executable. It will not recognize if you use a slightly different path, even if they both point to the same executable.

5. Recycle the Application Pool

In order for any PHP configuration changes to take effect in Windows 2003, you need to recycle the Application Pool. If you have made changes to php.ini and they don’t seem to take effect, this is likely the reason. Among other things, the pool caches PHP settings and you need to clear it before new configuration settings will take effect. You’ll read people telling you to restart IIS (which doesn’t recycle the app pool) or even reboot your machine (which is overkill). You don’t need to do either of those. Just right-click on the DefaultAppPool in the IIS management interface and “Recycle” is one of the options.

Recycle Pool

If I’m having trouble with the ini file, I like to have a typical phpinfo.php file on the server while I make some arbitrary change to the php.ini file (like the session timeout or the max upload size). I refresh phpinfo.php and verify that my changes are taking effect. You can also check the Windows Event logs under “System” which will sometimes report errors in the php.ini file.

Notes regarding re-running the PHP installer to make changes:

The PHP installer does not really handle changes all that well. For one thing it will overwrite the path to the PHP executable w/ the old DOS format so you need to fix that after you run it.

The 2nd thing is that it will write changes to C:\Program Files\PHP\php.ini - regardless of the fact that PHP is actually looking at C:\Windows\php.ini

If you had previously moved php.ini to the windows folder, when you run the Change installation feature, it will create a fresh php.ini file that only incorporates the most recent changes. (ie, if you had 10 extensions enabled and you make a change to enable 1 more, your new php.ini file will only have the 1 enabled and the previous 10 will no longer be enabled)

One way around this is to temporarily move C:\Windows\php.ini file to C:\Program Files\PHP. Then run in installer to make changes. The installer will write changes to php.ini in that location. Then, move php.ini back to C:\Windows.

Top 10 Reasons for NOT backing up your data

In this modern age we live in, who has time to backup their data? It’s such a hassle! Not to mention it’s really complicated and expensive. I was thinking about backups the other day and there’s practically *no reason* to do it! In fact, I came up with 10 reasons not to make backups. I think if you take a moment to read them you’ll agree with me that backups are simply a waste of time.

1. I just got a new computer, it’s not going to break

We all know that new stuff *never* breaks. Come on! Things only break after years and years. I’ve never purchased one single item that I had to return right away because it didn’t work correctly.

2. I’m really nice to my computer. People who lose their data probably are hitting their computer or something.

People who lose their data are obviously physically harming their computer in some way. They just don’t admit it because they’re embarrassed. Me, on the other hand, I am very gentle with my computer. I even give it a goodnight kiss before bed every evening.

3. Oh, I’m going to back up my files as soon as I get a chance…

I was planning on backing up my files last month but I got so busy, you know. I just didn’t get around to it. I’ll get to it pretty soon, though.

4. Hard drives start clicking before they crash - I’m confident I’ll be able to tell when it’s about to go.

Everybody knows that hard drives don’t just die instantly. They start clicking and making weird noises weeks before they crash. There’s plenty of warning. Besides, if it does crash, I’ll just stick it in the freezer and that’ll give me a few hours to get my data back.

5. My data isn’t really that important, I wouldn’t be too upset if it got lost.

I really wouldn’t miss any of my data if it got deleted. I have a lot of digital photos of vacations and my favorite niece when she was a baby and about 200 albums in iTunes or whatever. But, I don’t really need that stuff. It’s not like my quicken bank file, job resume or my thesis or anything important is on there.

6. Making backups is too technical and complicated to do correctly.

Making backups is so technical. You have to have giant tape machines and take them to a a bank vault and all of that stuff to do it properly. I can’t deal with that! Making a copy to an external drive is not really the right way to do it, so why even bother?
7. Backups are something that big companies do. Home users don’t need to worry about backups.

They backup stuff at work so I don’t really have to backup my own machine as well. I probably have some of my stuff on floppy drives somewhere anyway.

8. I don’t have anywhere to store my backup data.

If there were some free magical place where I could backup my files I might do it. I don’t really have any storage space to spare because my external drive is all filled up and I can’t really afford another one.

9. I don’t have time to wait around for my stuff to back up.

It takes forever to backup files. I don’t have time to sita around and wait on that. It makes me uncomfortable to have my computer doing stuff while I’m not watching it.

10. I could always just call a data recovery service to get the stuff off of my drive - it’s never totally gone.

Those recovery guys can get anything back off of your drive even if you dip it in gasoline and light it on fire! It’s not like somebody would ever steal my laptop or something. I’m totally rich, though, so I can afford it either way.

~~~

There you have it. Ten compelling reasons not to backup your files. Are you convinced? Leave me a comment and let me know how you feel about it.

older posts :: newer posts