PHP Hello World

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
m
Line 22: Line 22:
  
 
==Part II: Configuring Resin to Serve PHP Pages==
 
==Part II: Configuring Resin to Serve PHP Pages==
#Cut and paste the following xml text editor
+
#Cut and paste the "web.xml" into your favorite text editor.
 
#Save the file into c:\resin-3.0.14\webapps\ROOT\WEB-INF (NB: if you use Notepad, then be careful to either save as "all files" or just put the file name in double quotes.  IE: "web.xml").
 
#Save the file into c:\resin-3.0.14\webapps\ROOT\WEB-INF (NB: if you use Notepad, then be careful to either save as "all files" or just put the file name in double quotes.  IE: "web.xml").
#Cut and paste the following php into your favorite text editor
+
#Cut and paste the "HelloWorld.php" into your text editor.
 
#Save the file into C:\resin-3.0.14\webapps\ROOT (NB: as above, if you use Notepad, then be careful to either save as "all files" or just put the file name in double quotes.  IE: "HelloWorld.php").
 
#Save the file into C:\resin-3.0.14\webapps\ROOT (NB: as above, if you use Notepad, then be careful to either save as "all files" or just put the file name in double quotes.  IE: "HelloWorld.php").
  
===Example web.xml===
+
===web.xml===
  
 
  <web-app xmlns="http://caucho.com/ns/resin">
 
  <web-app xmlns="http://caucho.com/ns/resin">
Line 36: Line 36:
 
  </web-app>
 
  </web-app>
  
===Example HelloWorld.php===
+
===HelloWorld.php===
  
 
  <?php
 
  <?php
 
   echo "Hello World";
 
   echo "Hello World";
 
  ?>
 
  ?>

Revision as of 20:46, 14 November 2005


This short article is intended for PHP programers who are interested in trying Caucho's PHP implementation.

It is written for users of windows.

Contents

Part I: Installing Resin

Downloading and unzipping Resin

  1. Navigate to XXX://www.caucho.com/download
  2. Download the latest Resin Binary for your computer. For purposes of this demo, I have downloaded the Windows .zip binary.
  3. Save the file to your desktop.
  4. Double click the binary and unzip the file. For purposes of this demo, I have unzipped the contents to c:\resin-3.0.14

Running Resin for the first time

  1. Browse to the directory into which you unzipped the resin download (ie: c:\resin-3.0.14)
  2. Double-click httpd.exe. At this point the resin web server should start.
  3. Open your favorite browser and type in the following URL: XXX://localhost:8080
  4. You will now see Resin's Default Home Page


Part II: Configuring Resin to Serve PHP Pages

  1. Cut and paste the "web.xml" into your favorite text editor.
  2. Save the file into c:\resin-3.0.14\webapps\ROOT\WEB-INF (NB: if you use Notepad, then be careful to either save as "all files" or just put the file name in double quotes. IE: "web.xml").
  3. Cut and paste the "HelloWorld.php" into your text editor.
  4. Save the file into C:\resin-3.0.14\webapps\ROOT (NB: as above, if you use Notepad, then be careful to either save as "all files" or just put the file name in double quotes. IE: "HelloWorld.php").

web.xml

<web-app xmlns="http://caucho.com/ns/resin">
  <servlet-mapping url-pattern="*.php"
                   servlet-class="com.caucho.php.servlet.PhpServlet">
    <init compile="false"/>
  </servlet-mapping>
</web-app>

HelloWorld.php

<?php
  echo "Hello World";
?>
Personal tools