PHP Hello World

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
 
(37 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:PHP]]
+
[[Category:Quercus]]
  
The short article is intended for PHP programers who are interested in trying Resin's implementation.
+
==Introduction==
  
It is written for users of windows.
+
This short article is intended for PHP programers who are interested in trying Caucho's PHP implementation.  The download and unzipping instructions are intended for windows users.  However, the implementation will work just as well in UNIX.
  
 
==Part I: Installing Resin==
 
==Part I: Installing Resin==
  
 +
===Downloading and unzipping Resin===
 
#Navigate to http://www.caucho.com/download
 
#Navigate to http://www.caucho.com/download
#Download the latest Resin Binary for your computer. For purposes of this demo, I have downloaded the Windows .zip binary.
+
#Download the latest Resin binary for your operating system.
 +
#*For purposes of this demo, I have downloaded the Windows .zip binary.  The non-pro version is free to use.
 +
#*The extended features of the pro version are NOT required for our implementation of PHP.  If you want to try those features anyway, you can get a free limited-time evaluation license at http://www.caucho.com/license. Just fill out the form and a license will be mailed to you within minutes.
 
#Save the file to your desktop.
 
#Save the file to your desktop.
#Double click the binary and unzip the file. For purposes of this demo, I have unzipped the file to c:\resin-3.0.15
+
#Double click the binary and unzip the file.
 +
#*For purposes of this demo, I have unzipped the contents to c:\resin-3.0.14
  
==Part II: Running Resin==
+
===Running Resin for the first time===
  
5)
+
#Browse to the directory into which you unzipped the resin download (ie: c:\resin-3.0.14)
1) Click on the following [http://www.caucho.com/download/resin-3.0.14.zip http://www.caucho.com/download/resin-3.0.14.zip link]
+
#Double-click httpd.exe.  At this point the resin web server should start.
 +
#Open your favorite browser and type in the following URL: http://localhost:8080
 +
#You will now see Resin's Default Home Page
  
2) Save the file to your desktop.
+
==Part II: Configuring Resin to Serve PHP Pages==
 +
#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").
 +
#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").
 +
#Open your favorite browser and type in the following URL: http://localhost:8080/HelloWorld.php.
 +
 
 +
===web.xml===
 +
 
 +
<web-app xmlns="http://caucho.com/ns/resin">
 +
  <servlet-mapping url-pattern="*.php"
 +
                    servlet-class="com.caucho.quercus.servlet.QuercusServlet">
 +
  </servlet-mapping>
 +
</web-app>
 +
 
 +
===HelloWorld.php===
  
==Example PHP code==
 
 
 
  <?php
 
  <?php
+
  echo "Hello World";
echo "Hello World";
+
+
 
  ?>
 
  ?>
[http://www.example.com link title][[Link title]]
+
 
 +
==Conclusion==
 +
If all went well with the above steps, you have installed Resin correctly. Congratulations!
 +
 
 +
You can now create your own PHP pages and store them in the same directory as the HelloWorld.php file.

Latest revision as of 17:37, 9 January 2006


Contents

[edit] Introduction

This short article is intended for PHP programers who are interested in trying Caucho's PHP implementation. The download and unzipping instructions are intended for windows users. However, the implementation will work just as well in UNIX.

[edit] Part I: Installing Resin

[edit] Downloading and unzipping Resin

  1. Navigate to http://www.caucho.com/download
  2. Download the latest Resin binary for your operating system.
    • For purposes of this demo, I have downloaded the Windows .zip binary. The non-pro version is free to use.
    • The extended features of the pro version are NOT required for our implementation of PHP. If you want to try those features anyway, you can get a free limited-time evaluation license at http://www.caucho.com/license. Just fill out the form and a license will be mailed to you within minutes.
  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

[edit] 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: http://localhost:8080
  4. You will now see Resin's Default Home Page

[edit] 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").
  5. Open your favorite browser and type in the following URL: http://localhost:8080/HelloWorld.php.

[edit] web.xml

<web-app xmlns="http://caucho.com/ns/resin">
  <servlet-mapping url-pattern="*.php"
                   servlet-class="com.caucho.quercus.servlet.QuercusServlet">
  </servlet-mapping>
</web-app>

[edit] HelloWorld.php

<?php
  echo "Hello World";
?>

[edit] Conclusion

If all went well with the above steps, you have installed Resin correctly. Congratulations!

You can now create your own PHP pages and store them in the same directory as the HelloWorld.php file.

Personal tools