PHP website on CD?

Discussion in 'Web Design and Development' started by Mal, Sep 25, 2007.

  1. Mal macrumors 603

    Mal

    Joined:
    Jan 6, 2002
    Location:
    Orlando
    #1
    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
     
  2. elppa macrumors 68040

    elppa

    Joined:
    Nov 26, 2003
    #2
    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.
     
  3. Stampyhead macrumors 68020

    Stampyhead

    Joined:
    Sep 3, 2004
    Location:
    London, UK
    #3
    Sorry, PHP requires a server in order to run.
     
  4. Cabbit macrumors 68020

    Cabbit

    Joined:
    Jan 30, 2006
    Location:
    Scotland
    #4
    i did download a self contaned php app before, it was some sort of rpg game.
     
  5. king756 macrumors newbie

    Joined:
    Jan 13, 2007
    #5
    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.
     
  6. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #6
    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.
     
  7. markoibook macrumors regular

    Joined:
    Jan 28, 2004
    Location:
    Reading, UK.
    #7
    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!
     
  8. ChicoWeb macrumors 65816

    ChicoWeb

    Joined:
    Aug 16, 2004
    Location:
    California
    #8
    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.
     
  9. Mal thread starter macrumors 603

    Mal

    Joined:
    Jan 6, 2002
    Location:
    Orlando
    #9
    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
     
  10. Mal thread starter macrumors 603

    Mal

    Joined:
    Jan 6, 2002
    Location:
    Orlando
    #10
    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
     
  11. Malfoy macrumors 6502a

    Malfoy

    Joined:
    Nov 1, 2005
    #11
    If its meant to be static, just do a save as on each page.
     
  12. JPT macrumors regular

    Joined:
    May 4, 2006
    #12
    Upload files to a PHP website and give the URL to your teacher? Not sure if that would be acceptable though...
     
  13. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #13
    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.
     
  14. bigandy macrumors G3

    bigandy

    Joined:
    Apr 30, 2004
    Location:
    Murka
    #14
  15. Mal thread starter macrumors 603

    Mal

    Joined:
    Jan 6, 2002
    Location:
    Orlando
    #15
    :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).
     
  16. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #16
    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.
     
  17. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #17
    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.
     

Share This Page