There’s no server available on an iPad (or any iOS device). So anything that relies on PHP executing in the context of an Apache server will not run at all. But if your application is more of a CMS than a true Web app, you can simulate this quite easily using wget to crawl the site and download it as html files. The links between files will be converted so they still work, and the entire site – even a deep “fake” hierarchy – will be duplicated on your desktop, and you can browse it from local storage, assuming you can figure out how to link to the index.html file in the first place from local storage.
Here’s where you have to start:
-
Make sure you are using “pretty” URLs in your application. No querystrings allowed, so no filename.php?foo=bar&baz=blarg. You can use a simple .htaccess rule to rewrite these into /foo/bar/baz/blarg.html -style URLs instead.
-
Make sure you’re not relying on sessions or cookies for any part of your experience.
-
Host your site on a server that DOES have PHP running, and make sure it works perfectly when browsed by a regular browser.
If you haven’t installed wget (it used to be standard, and now you have to install it separately) do so[1]. Then open Terminal.app, move into a folder somewhere, maybe like this: cd Documents, and enter this command (adjusted for your site address):
/usr/bin/env wget --html-extension --recursive --convert-links http://www.softpress.com
You will end up with a folder in your Documents folder called www.yourapp.com, containing the entire site – everything that wget could find a link to, anyway – recursively crawled and converted into HTML. All URLs will work, all image paths will be relative, and all foreground images will be copied over. Please note that any background images, or any images referenced in the CSS or JavaScript will not be copied over, so some post-processing may be needed, either copying over files, or updating paths in script or stylesheets to match the new reality.
Test the result in a browser with the network disconnected. Make sure that there are no dependencies on files you won’t have with you. Now make sure you can get the files onto your iPad. Maybe use DropBox or something like that, this is the one part I haven’t tried, so I don’t know how you’ll get this part done. But converting a dynamically-generated site into static is a fairly simple trick (as such things go).
Walter
- Be sure you have Xcode installed, then download http://ftp.gnu.org/gnu/wget/wget-latest.tar.gz, open Terminal.app, and do the following:
cd Downloads
tar xzf wget-1.9.1.tar.gz
cd wget-1.9.*
./configure
make
sudo make install
On May 17, 2011, at 9:02 AM, Todd wrote:
Until now I’ve been able to take a MBP to show off a website using Apache
and PHP.
Now I’d like to do the same on an iPad.
Q: Has anyone done this?
What is the procedure?
I’ve found “claims” of this being possible with 3rd Party hack software but it seems very dangerous. I’m dubious it’s even possible. I think it would be extremely difficult to port PHP and Apache to the very restricted iPad. I would like to be proven wrong though! Anyone?
Todd
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options