Hi. I have managed to make an automated way to compile a simple PHP application to a bunch of static files and I share it, I hope some of you find it useful. This has some advantages: Security: no code is best code. Speed: faster response times and better scalability. Price: hosting the site will cost less money. Stability: less things running means less chance of something breaking. I have tried several static generators but in the end they shoot me in the foot. So the best for me is to run PHP locally, compile and upload to the server. Compile script I assume the PHP application has pretty urls, all of them ended in '/' character. First of all, set two entries in /etc/hosts pointing to 127.0.0.1 (example.home and example.sandbox). Once the PHP application is running on http:// example.home, I make a recursive download using wget with -r and --adjust-extension options. This download the full sites and attaches index.html termination to every page. Next thing to do is replace the domain name in the case you use base href HTML tag.Next thing to do is replace the domain name in the case you use base href HTML tag. Packaging all of this in a small script: rm -rf example.sandbox wget -r --adjust-extension http://example.home mv example.home example.sandbox for i in `find example.sandbox -name "*html"`; do sed -i 's/example.sandbox/example.com/g' $i; done Code (markup): Upload script After testing that example.sandbox works fine, change example.sandbox references to example.com and upload it to the server: for i in `find example.sandbox -name "*html"`; do sed -i 's/example.sandbox/example.com/g' $i ; done rsync -czrpgoD --rsh="ssh" example.sandbox/* server:/htdocs/example.com ssh server "sh ~/wwwsync.sh" Code (markup): Last line executes a script to sync the second server for redundancy. Related article: Go static or go home by Paul Vixie.
While that is perfectly fine for very simple applications, why would you even need to have PHP for such simple websites? The minute you need database-access, dynamic content, etc., your solution won't work - and if you don't need any dynamic content, then you can just code them in plain HTML/CSS anyway.
With PHP I can do more things like templating, tags, pagination and add content very fast without having to edit tons of pages. Doing this in plain HTML/CSS is painful.
I am trying, and failing, to come up with a rational use case for your solution. SSI would handle low level templating. Or, for that matter, Emacs's Org Mode see here for includes. For more, see Org Manual, especially the export section. Org Mode is an integral part of the Emacs text editor. gary
I have looked at the link but it seems too complicated for me (I never used emacs), I just want to write plain HTML with any plaintext editor and get the content formatted into a website automatically. One advantage of PHP is that it's designed for the web and there are tons of useful functions and libraries, it gives me freedom instead of restrictions like all static site generators I have tried. This made the trick for me, I'm surprised you don't find it useful (at least for certain use cases). I find very convenient to have locally a dynamic site and, from time to time, "freeze" and upload it into production.
It looks daunting if you don't realize you need only learn what you are using. I've used Emacs for about twenty years and still only know a small portion of its capabilities. Not a worry, since if I need to, I go to the manual and learn enough to get by this time and then forget it until the next time. What I use regularly, I do without having to think about it. The text editor is where you live and I understand if you don't want to change; it's like a cook and his knives, personal. gary