Mini Servers: Apache 2.2.9 PHP 5.2.6 Portable: Difference between revisions

m
no edit summary
(New page: {{Uc nav mini servers}} Apache 2.2.9|right'''Mini server using Apache 2.2.9 and PHP 5.2.6 Core''' This mini server packs a real punch; trouble is it also packs a ...)
 
mNo edit summary
Line 1: Line 1:
{{Uc nav mini servers}}
{{Uc nav mini servers}}
[[Image:Uc_mini_2a.gif|Apache 2.2.9|right]]'''Mini server using Apache 2.2.9 and PHP 5.2.6 Core'''
[[Image:Uc_mini_2a.gif|Apache 2.2.9|right]]'''Mini Server 6 using Apache 2.2.9 and PHP 5.2.6 Core'''


This mini server packs a real punch; trouble is it also packs a real disk hit, increases server size from 1.03MB to 6MB. However adding the PHP 5.2.6 core greatly extends the server's power.
This mini server packs a real punch; trouble is it also packs a real disk hit, increases server size from 1MB to 6MB. However adding the PHP 5.2.6 core greatly extends the server's power.


Hey not much use without a MYSQL server! So you have never considered file databases as an alternative. The support files include an excellent example; it’s a quest book (Version 1.7.2) from the DigiOz stable. A single file database, code is well commented and easy to follow. These chaps produce height quality open source software, their site is more than worth a visit, and forum is friendly check out their tutorials. I would like to thank Pete for his kind permission to use the DigiOz logo and use the quest book as an example.
Hey not much use without a MYSQL server! So you have never considered file databases as an alternative. The support files include an excellent example; it’s a quest book (Version 1.7.2) from the [http://www.digioz.com/ DigiOz] stable. A single file database, code is well commented and easy to follow. These chaps produce height quality open source software, their site is more than worth a visit, and forum is friendly check out their tutorials. I would like to thank Pete for his kind permission to use the DigiOz logo and use the quest book as an example.


Note: Check the support files section for download details.
Note: Check the [[#Support files|support files]] section for server download details.


== Security ==
== Security ==
Line 30: Line 30:
'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
== Configuring Apache ==
== Configuring Apache ==
Using the configuration file from [[Mini Servers: Apache 2.2.9 Portable|uc server 1a]] very few changes are required these I have highlighted in bold.
Using the configuration file from [[Mini Servers: Apache 2.2.9 Portable|Mini Server 1a]] very few changes are required these I have highlighted in bold.
   
   
{|border="0" cellpadding="4" cellspacing="1" style="background:#222222"
{|border="0" cellpadding="4" cellspacing="1" style="background:#222222"
Line 38: Line 38:
|-style="background:#f5f5f5"
|-style="background:#f5f5f5"
|
|
<nowiki>#</nowiki> UniCenter - Very basic server<br>
<nowiki>#</nowiki> File name: http.conf<br>
<nowiki>#</nowiki> Author: Mike Gleaves <br>
<nowiki>#</nowiki> Created By: The Uniform Server Development Team<br>
<nowiki>#</nowiki> Edited Last By: Mike Gleaves (ric) <br>
<nowiki>#</nowiki> Main Apache 2.2.9 HTTP server configuration file.<br>
<nowiki>#</nowiki> Main Apache 2.2.9 HTTP server configuration file.<br>
<nowiki>#</nowiki> 14-7-2008
<nowiki>#</nowiki> Supports PHP<br>
<nowiki>#</nowiki> V 1.0 14-7-2008
|
|
&nbsp;
&nbsp;
Line 62: Line 64:
<nowiki>#</nowiki> ======================================== <br>
<nowiki>#</nowiki> ======================================== <br>
&nbsp;'''PHPIniDir "/usr/local/php/"''' <br>
&nbsp;'''PHPIniDir "/usr/local/php/"''' <br>
&nbsp;Listen 80 <br>
&nbsp;'''Listen 8086''' <br>
&nbsp;ServerName localhost:80<br>
&nbsp;ServerName '''localhost:8086'''<br>
&nbsp;ServerAdmin fred@www.somedomain.com <br>
&nbsp;ServerAdmin fred@www.somedomain.com <br>
&nbsp;UseCanonicalName Off <br>
&nbsp;UseCanonicalName Off <br>
Line 81: Line 83:


'''DirectoryIndex:''' When a user requests a page supplying only a folder name (example fred.com) the index page is automatically returned by default. Note you can have more than one index page in the same folder with a different file extension. Order of priority left to right, first one found in the list is returned, all other are ignored. I have added '''index.php''' to this list.
'''DirectoryIndex:''' When a user requests a page supplying only a folder name (example fred.com) the index page is automatically returned by default. Note you can have more than one index page in the same folder with a different file extension. Order of priority left to right, first one found in the list is returned, all other are ignored. I have added '''index.php''' to this list.
'''''Note'':''' Moved server port to 8086 prevents clashing with other servers.
|-style="background:#f5f5f5"
|-style="background:#f5f5f5"
|
|
Line 171: Line 175:
PHP 5.2.6 zip package [9,516Kb] - 3 May 2008 located in the “Windows Binaries” section
PHP 5.2.6 zip package [9,516Kb] - 3 May 2008 located in the “Windows Binaries” section


After downloading unzip to any folder, locate files '''php5apache2_2.dll''', '''php5ts.dll''' and '''php.ini-recommended''' copy these to mini server folder '''*\uc_server_2a\udrive\usr\local\php'''
After downloading unzip to any folder, locate files '''php5apache2_2.dll''', '''php5ts.dll''' and '''php.ini-recommended''' copy these to mini server folder '''*\mini_server_6\udrive\usr\local\php'''


Rename the file '''php.ini-recommended''' to '''php.ini'''
Rename the file '''php.ini-recommended''' to '''php.ini'''
Line 180: Line 184:


== php.ini ==
== php.ini ==
Open '''php.ini''' have a read, yep its not a bedtime classic it’s a long confusing read. So what do you change! Surprisingly very little, to get you up and running the following table shows the lines that need changing:
Open '''php.ini''' have a read, yep its not a bedtime classic it’s a long confusing read. So what do you change! Surprisingly very little, to get you up and running the following table shows the lines that require changing:


{|border="0" cellpadding="2" cellspacing="1" style="background:#000000"
{|border="0" cellpadding="2" cellspacing="1" style="background:#000000"
|-style="background:#e8e8e8"
|-style="background:#e8e8e8"
!Line 
!Line 
!php.ini located in folder: *\uc_server_2a\udrive\usr\local\php
!php.ini located in folder: *\mini_server_6\udrive\usr\local\php
|-style="background:#f5f5f5"
|-style="background:#f5f5f5"
|131||short_open_tag = On
|131||short_open_tag = On
Line 232: Line 236:
For extension you enable the appropriate line in the php.ini file remember to copy a corresponding dll into the extensions folder.  
For extension you enable the appropriate line in the php.ini file remember to copy a corresponding dll into the extensions folder.  


'''''Note 2'':''' Line 466 '''register_globals = Off''' this is the default keep it that way. There are security issues if you tun it on.   
'''''Note 2'':''' Line 466 '''register_globals = Off''' this is the default keep it that way. There are security issues if you tun it on. Checks out the included example site explaining why register_globals are evil.   


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
== Testing ==
== Testing ==
* Start the server by double clicking on '''uc_server_start.bat'''
* Start the server by double clicking on '''server_start.bat'''
* Type '''<nowiki>http://localhost</nowiki>''' into your browser address bar.
* Type '''<nowiki>http://localhost:8086</nowiki>''' into your browser address bar.
* Check out the test site confirms the server is working.
* Check test site runs, this confirms the server is working.
* Close the server using '''uc_server_stop.bat'''
* Close the server using '''server_stop.bat'''


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
Line 364: Line 369:


=== Download ===
=== Download ===
Download this server from the mini server's [[Mini Servers: Support and download#UC Server 2a|Support and download page.]] Save the file uc_server_2a.exe to any folder of your choice.
Download this server from SourceForge [http://sourceforge.net/projects/miniserver Project Page] save the file '''mini_server_6.exe''' to any folder of your choice.


'''''Note'':''' Check the file's integrity using its MD5 a suitable checker '''winMd5Sum Portable''' can be found at [http://portableapps.com/apps Portable Apps] under Utilities.
'''''Note'':''' Check out the mini server's [[Mini Servers: Support and download|support and download page]] detailing how to obtain full binaries for Apache and PHP.


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''


=== Extract files ===
=== Extract files ===
Double click on uc_server_2a.exe, starts the extraction process.
Double click on mini_server_6.exe, starts the extraction process.


No need to change the folder destination, click extract, this creates a new folder '''uc_server_2a''' containing the following:
No need to change the folder destination, click extract, this creates a new folder '''mini_server_6''' containing the following:
{|
{|
|-
|-
Line 379: Line 384:
{|cellpadding="2"
{|cellpadding="2"
|-
|-
|valign="top"|'''Top level folder'''||uc_server_2a contains two files:<br>1) '''uc_server_start.bat''' - Double click to start the<br>2) '''uc_server_stop.bat''' - Double click to stop server
|valign="top"|'''Top level folder'''||mini_server_6 contains two files:<br>1) '''server_start.bat''' - Double click to start the<br>2) '''server_stop.bat''' - Double click to stop server
|-
|-
|'''program folder''':||Uniform Server's programs that make the server portable
|'''program folder''':||Uniform Server's programs that make the server portable
Line 391: Line 396:
|'''www folder:'''||This is where you put your web site or sites
|'''www folder:'''||This is where you put your web site or sites
|-
|-
|valign="top"|'''Test sites''':||guestbook, mpg1 and mpg2 are test sites these are included to<br>
|valign="top"|'''Test sites''':||guestbook, test1 and test2 are test sites these are included to<br>
provide an idea of the servers capability's. Delete these folders and<br>
provide an idea of the servers capability's. Delete these folders and<br>
copy your sites into this folder (Referred to as the document root folder)
copy your sites into this folder (Referred to as the document root folder)
|}
|}
|
|
[[Image:Uc_server2a_dir.gif]]
[[Image:Uc_mini_server_6_dir.gif]]
|}
|}


Line 406: Line 411:
Testing is straight forward.
Testing is straight forward.


# Start the server by double clicking on uc_server_start.bat (Creates a virtual drive "w" to run the server on)
# Start the server by double clicking on '''server_start.bat''' (automatically detects free drive letter creates new virtual drive and runs the server.)  
# Start a web browser.
# Start a web browser.
# Type http://localhost/ into the browser address bar.
# Type '''<nowiki>http://localhost:8086/</nowiki>''' into the browser address bar.
# An index page is displayed, check out the test sites MPG1, MPG2 and guestbook.
# An index page is displayed, check out test sites MPG1, MPG2 and guestbook.
# Stop the server by double clicking on uc_stop.bat
# Stop the server by double clicking on server_stop.bat
 
'''''[[#top | Top]]'''''
 
=== Your web site ===
Open the folder www located in folder '''*mini_server_6\udrive\www''' (Note * is the path to the folder you extracted the server files) delete everything in '''www''' and copy your site into it.
 
'''''Note'':''' Make sure one of your pages in folder www is named '''index.html''', '''index.htm''' or '''index.php''', otherwise you will need to type a page name in every time to access your site.
 
e.g. <nowiki>http://localhost:8086/somepage.html</nowiki>
 
'''''[[#top | Top]]'''''


'''''Note'':''' If you need to change the virtual drive letter open file uc_server_start.bat locate this line:
== Change Virtual Drive ==
The server automatically detects the first free drive letter and uses that to run the server on.
You can override this in one of two ways:


'''if "%Disk%"=="" set Disk=w''' and change the drive letter from "'''w'''" to one that is not being used.
# Start the server using a drive parameter for example: '''server_start.bat z''' this forces the server to use drive z
# Edit server_start.bat, locate the following line:<br>&nbsp;&nbsp;'''rem set Disk=w''' <br>Remove the rem and replace w with the letter you want to use for example:<br>&nbsp;&nbsp;'''set Disk=x'''&nbsp; Forces the server to use drive letter x


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''


=== Your web site ===
== Change server default port ==
Open the folder www located in folder '''*uc_server_2a\udrive\www''' (Note * is the path to the folder you extracted the server files) delete everything in '''www''' and copy your site into it.
*Open file: '''httpd.conf''' (Located in folder: \mini_server_6\udrive\usr\local\apache2\conf)
*Locate the lines:<br>Listen 8086<br>ServerName localhost:8086<br>
*Change to:<br>Listen 8080<br>ServerName localhost:8080
 
This moves the server to the standard secondary web server port
 
'''''Note'':''' Type '''<nowiki>http://localhost:8080</nowiki>''' into a browser to view the site.
 
If port already in use try any value above 2000
 
'''''[[#top | Top]]'''''
 
== Multi Servers ==
If you wish to run several mini servers at the same time create a new folder for each server and copy contents of mini_server_6 into each of these.


'''''Note'':''' Make sure one of your pages in folder www is named '''index.html''' or '''index.htm''', otherwise you will need to type a page name in every time to access your site.
Change the server port for each server to be unique. The servers may be started in any order.


e.g. <nowiki>http://localhost/somepage.html</nowiki>
'''''Note'':''' You can run the mini servers alongside Uniform Server 3.5-Apollo however you must start Uniform Server first.


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
Line 430: Line 462:
This mini server is ideal for learning PHP its compact size allows you have several copies installed on a USB pen drive each with different test applications. I have covered how to secure the server and PHP in the real world you also must pay attention to securing your PHP scripts. Included with the support files is a guest book script that demonstrates some of the techniques used.
This mini server is ideal for learning PHP its compact size allows you have several copies installed on a USB pen drive each with different test applications. I have covered how to secure the server and PHP in the real world you also must pay attention to securing your PHP scripts. Included with the support files is a guest book script that demonstrates some of the techniques used.


When you change the scripts configuration file hopefully you will notice there is a fundamental problem, on the [[Mini Servers: Server 2a Guest book|next page]] I show how to resolve this, in addition cover some defensive programming.
When you change the scripts configuration file hopefully you will notice there is a fundamental problem, on the [[Mini Servers: Apache 2.2.9 PHP 5.2.6 Service|next page]] I show how to resolve this, in addition cover some defensive programming.


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
Line 437: Line 469:


{|
{|
| [[Image:uc_small_logo.gif]] || [[User:Ric|Ric]]
| [[Image:Uc_small_logo.gif]] || [[User:Ric|Ric]]
|}
|}


[[Category: UniCenter]]
[[Category: UniCenter]]
[[Category: Mini Servers]]
[[Category: Mini Servers]]
[[Category: PHP]]
[[Category: Oily Rag]]
[[Category: Oily Rag]]
[[Category: Self Install]]
[[Category: Self Install]]