Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Mal

macrumors 603
Original poster
Jan 6, 2002
6,253
30
Orlando
I have a class project that will need to be turned in on a CD at the end of the semester, but I want to develop it in PHP if at all possible, because it will be far easier to work with. Is there a simple way to place a PHP based website on a CD so that it can run without the server-side technology (or internet connectivity at all) available?

jW
 
no.

Edit That was based on my understanding of php as a server side scripting language. Look like it is possible with some messing around.
 
I would say yes it is possible.

Download slax or some other easily customisable linux bootcd. Configure php / mysql to be installed by default with your database and php files. Set it to automaticaly load the browser with it's homepage set to your app and jobs a good un. Only worry you will have is persisting data as data added to the database will be lost on reboot.

I know slax is very easy to customise so would be my first point of call. They may even have php / mysql modules listed on their website. You just extract the iso, drag the modules to the module folder and burn / recreate the iso. VMWare would be a good application for testing the disc instead of waisting blank cd's.
 
Everything is possible

Here's a pricey option, http://www.byterun.com/website-compiler.php

This might have something useful (didn't read much of it) http://www.x-author.de/en/tools/amp/x-author_02.html

Linux type resource for this, http://club.mandriva.com/xwiki/bin/view/KB/DistribWeb

A Windows only solution, http://www.outsite-in.com/

Another Windows solution, http://portableapps.com/apps/development/xampp

So there's 5 options despite other people saying "no," but they still aren't great Mac solutions unfortunately, but if they work for you, woohoo.
 
Hi,

There are quite a few free solutions out there, but I'm afraid I can't think of them all right now. I think that they are mainly aimed at Windows though unfortunately, but I'm sure you'll be able to find some other solutions if you look hard enough.
Here is one such Windows solution:
http://server2go.fantastic-bits.de
Has the benefit that it also includes the GD libraries with PHP 5 and also supports MySQL.
Definitely worth a look.
There is another one too that I've looked at, but it's name escapes me right now.

Hope this helps!
 
Is it Dynamic code? I can't possibly even imagine that working and or interacing with a non-writable CD. However, I've seen tools that will take your PHP code and create static versions, but to a certain extent I would imagine.
 
Is it Dynamic code? I can't possibly even imagine that working and or interacing with a non-writable CD. However, I've seen tools that will take your PHP code and create static versions, but to a certain extent I would imagine.

Yes, that's all I'm looking for. Basically, I'll be using includes for the menus and header/footer, but it'll be a fairly large site so I don't want to simply copy and save the output of each file manually. It doesn't actually have to be dynamic PHP available running from the CD, and in fact shouldn't be, I want this to turn out very simple.

jW
 
So wait, no one knows how to do this? I've heard of ways in the past, I just can't remember them, but I know it's really simple and possible. All I need it to do, to put it another way, is to make a static HTML copy of a website designed with PHP so that it can run without a PHP server.

jW
 
Upload files to a PHP website and give the URL to your teacher? Not sure if that would be acceptable though...
 
So wait, no one knows how to do this? I've heard of ways in the past, I just can't remember them, but I know it's really simple and possible. All I need it to do, to put it another way, is to make a static HTML copy of a website designed with PHP so that it can run without a PHP server.

jW

People have posted options. Did you not see them. Another solution since you don't really need PHP except for including the header and footer would be to use XML and XSL. You create the main content of the page in XML files, then use XSL to transform each XML file into a HTML file with your defined header and footer. If you're not familiar with this technique it'll take a small learning curve, but definitely possible since I've used it a number of times.
 
People have posted options. Did you not see them. Another solution since you don't really need PHP except for including the header and footer would be to use XML and XSL. You create the main content of the page in XML files, then use XSL to transform each XML file into a HTML file with your defined header and footer. If you're not familiar with this technique it'll take a small learning curve, but definitely possible since I've used it a number of times.

:rolleyes: People posted, yes. They weren't things I could use for this purpose.

I may look into doing the XML and XSL route, I'll have to look up how to do it though. I have to be careful though, the computer she's going to be using to look at these isn't very good so I can't depend on it working correctly with much more than just HTML.

bigandy, that portablewebap.com link seems like it might work, but just so you know, MicroWeb doesn't seem to support PHP, just CGI and MySQL (I'm not doing database driven stuff, so I wouldn't even need that).
 
:rolleyes: People posted, yes. They weren't things I could use for this purpose.

I may look into doing the XML and XSL route, I'll have to look up how to do it though. I have to be careful though, the computer she's going to be using to look at these isn't very good so I can't depend on it working correctly with much more than just HTML....

Well you didn't state what was wrong with them so it's hard to narrow things down, but anywho... Don't worry about the person's computer, the output of the XSL will be standard HTML files. They won't see any of the XML or XSL. If I get a chance I'll try to post some code for it.
 
XML XSL transformation

OK, I whipped up some quick XML and XSL to show how what I explained earlier can be done.

First you have you pages structured like so (the <xml-stylesheet ... line is optional but will let you view the result in your browser when you load the XML file),
Code:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="page.xsl"?>
<page>
<info>
  <title>Page Title</title>
  <keywords>some keywords</keywords>
  <description>the description</description>
</info>
<content><!-- normal HTML for the page -->
  <h1>Content Title</h1>
  <p>Paragraph with text.</p>
</content>
</page>
Here's some XSL that'll transform it into HTML (the parts with the <xsl:text> contains just a carriage return for formatting the output a little more.)
Code:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 version="1.0">
<xsl:output indent="yes" encoding="utf-8"
  omit-xml-declaration="no"
  doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
  doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />

<xsl:template match="page">
<html><xsl:text>
</xsl:text>
<head><xsl:text>
</xsl:text>
<title><xsl:value-of select="info/title"/></title><xsl:text>
</xsl:text>
<meta name="keywords" content="{info/keywords}" /><xsl:text>
</xsl:text>
<meta name="description" content="{info/description}" /><xsl:text>
</xsl:text>
</head><xsl:text>
</xsl:text>
<body><xsl:text>
</xsl:text>
<xsl:call-template name="header"/>
<xsl:call-template name="navigation"/>
<xsl:apply-templates select="content"/>
<xsl:call-template name="footer"/>
</body></html>
</xsl:template>

<xsl:template name="header">
<div id="header"><xsl:text>
</xsl:text>
  <h1>The Header</h1><xsl:text>
</xsl:text>
</div><xsl:text>
</xsl:text>
</xsl:template>

<xsl:template name="navigation">
<div id="navigation"><xsl:text>
</xsl:text>
<ul><xsl:text>
</xsl:text>
  <li><a href="#">Nav item 1</a></li><xsl:text>
</xsl:text>
</ul><xsl:text>
</xsl:text>
</div><xsl:text>
</xsl:text>
</xsl:template>

<xsl:template name="footer">
<div id="footer">
  <p>The footer</p><xsl:text>
</xsl:text>
</div><xsl:text>
</xsl:text>
</xsl:template>

<xsl:template match="content">
<div id="content">
  <xsl:apply-templates/>
</div>
</xsl:template>

<xsl:template match="content/*">
  <xsl:copy-of select="."/>
</xsl:template>

</xsl:stylesheet>
This is the HTML that you get after the transformation,
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Page Title</title>
<meta name="keywords" content="some keywords">
<meta name="description" content="the description">
</head>
<body>
<div id="header">
<h1>The Header</h1>
</div>
<div id="navigation">
<ul>
<li><a href="#">Nav item 1</a></li>
</ul>
</div>
<div id="content">
  <h1>Content Title</h1>
  <p>Paragraph with text.</p>
</div>
<div id="footer">
<p>The footer</p>
</div>
</body>
</html>
I do my transformations from Terminal with the command "xsltproc --novalid -o page.html page.xsl page.xml" You can also do "man xsltproc" to see its other options. There's options for transforming a directory of files, which may help if you have a lot of files. Let me know if you need further help with this.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.