Difference between revisions of "WAMP"

From HaFrWiki
Jump to: navigation, search
(Created page with "{{TOCright}} {{TOCright}} WAMP server <ref>[http://sourceforge.net/projects/wamp-server WAMP-Server] is a SourceForge Project.</ref> is Windows Apache MySQL PHP Server all bun...")
 
m
Line 4: Line 4:
 
This package is great to test your projects, you don't need to upload every time you need to test a change.
 
This package is great to test your projects, you don't need to upload every time you need to test a change.
 
You can test everything from you own Windows machine.
 
You can test everything from you own Windows machine.
 +
 +
There are more platform specific implementations:
 +
* LAMP, Linux Apache MySQL and PHP
 +
* MAMP, Mac Apache MySQL and PHP
  
 
== Intranet Access ==
 
== Intranet Access ==
Line 10: Line 14:
 
* OS Hosts settings
 
* OS Hosts settings
 
* Router settings
 
* Router settings
 +
 +
== Shell Scripts ==
 +
To enable the execution of scripts like ksh you need to activate CGI in MAMP. This section shows how.
 +
The default setup only allows CGI scripts to execute out of the default: ‘Applications/MAMP/cgi-bin’ directory.
 +
 +
* Open ‘Applications/MAMP/conf/apache/httpd.conf’ in a text editor of your choice.
 +
* Search the Document for – ‘AddHandler cgi-script .cgi’ <br>That line should be commented out, remove the ‘#’ to uncomment this and add ‘.pl’ to the line  (PL files are a common file type used in cgi scripts, so that is why we are adding ‘.pl’ to the line) <br>Your line should now look like this: ‘AddHandler cgi-script .cgi .pl’
 +
* Now search the document for this segment of code:
 +
<pre>
 +
<Directory />
 +
Options Indexes FollowSymLinks
 +
AllowOverride None
 +
</Directory>
 +
</pre>
 +
* Modify the code to look like this:
 +
<pre>
 +
<Directory />
 +
Options Indexes FollowSymLinks
 +
AllowOverride None
 +
Options FollowSymLinks +ExecCGI
 +
</Directory>
 +
</pre>
 +
* Open MAMP Application, and restart the server
 +
* Finished!  CGI scripts should now work anywhere you place them.
 +
 +
== Execute Scripts ==
 +
The scripts does not run without customization:
 +
* You need to store program in '''cgi-bin''' directory.
 +
** Debian Linux default location for cgi-bin directory: /usr/lib/cgi-bin.
 +
** Red Hat / Fedora it is /var/www/cgi-bin.
 +
** MAMP: /Application: /Applications/MAMP/cgi-bin
 +
 +
Now take this example Bash-cgi-test program:
 +
<pre>
 +
#!/bin/bash
 +
echo "Content-type: text/html"
 +
echo ""
 +
echo "<html><head><title>Bash as CGI"
 +
echo "</title></head><body>"
 +
echo "<h1>Hello world</h1>"
 +
echo "Today is $(date)"
 +
echo "</body></html>"
 +
</pre>
 +
 +
Save and close the file. Setup execute permission on the script:
 +
<pre>
 +
$ chmod +x first.cgi
 +
</pre>
 +
 +
  
 
== See also ==
 
== See also ==

Revision as of 10:59, 24 November 2013

WAMP server [1] is Windows Apache MySQL PHP Server all bundled into one nice package. This package is great to test your projects, you don't need to upload every time you need to test a change. You can test everything from you own Windows machine.

There are more platform specific implementations:

  • LAMP, Linux Apache MySQL and PHP
  • MAMP, Mac Apache MySQL and PHP

Intranet Access

If you running WAMP and want to connect to a local installed WAMP server, you may need to alter/configure:

  • Apache HTTP Server Configuration
  • OS Hosts settings
  • Router settings

Shell Scripts

To enable the execution of scripts like ksh you need to activate CGI in MAMP. This section shows how. The default setup only allows CGI scripts to execute out of the default: ‘Applications/MAMP/cgi-bin’ directory.

  • Open ‘Applications/MAMP/conf/apache/httpd.conf’ in a text editor of your choice.
  • Search the Document for – ‘AddHandler cgi-script .cgi’
    That line should be commented out, remove the ‘#’ to uncomment this and add ‘.pl’ to the line (PL files are a common file type used in cgi scripts, so that is why we are adding ‘.pl’ to the line)
    Your line should now look like this: ‘AddHandler cgi-script .cgi .pl’
  • Now search the document for this segment of code:
<Directory />
Options Indexes FollowSymLinks
AllowOverride None
</Directory>
  • Modify the code to look like this:
<Directory />
Options Indexes FollowSymLinks
AllowOverride None
Options FollowSymLinks +ExecCGI
</Directory>
  • Open MAMP Application, and restart the server
  • Finished! CGI scripts should now work anywhere you place them.

Execute Scripts

The scripts does not run without customization:

  • You need to store program in cgi-bin directory.
    • Debian Linux default location for cgi-bin directory: /usr/lib/cgi-bin.
    • Red Hat / Fedora it is /var/www/cgi-bin.
    • MAMP: /Application: /Applications/MAMP/cgi-bin

Now take this example Bash-cgi-test program:

#!/bin/bash
echo "Content-type: text/html"
echo ""
echo "<html><head><title>Bash as CGI"
echo "</title></head><body>"
echo "<h1>Hello world</h1>"
echo "Today is $(date)"
echo "</body></html>"

Save and close the file. Setup execute permission on the script:

$ chmod +x first.cgi


See also

top

  • Wireless, Information and Hosts settings for Windows Apache MySQL PHP Server. Contains the HaFr-Wiki site.
    The Hosts file are important to connect to Harm-Subversion and HaFr-Wiki.
  • Pear, Installation of Pear on Mac, which is needed for running phpunit.


Reference

top

  1. WAMP-Server is a SourceForge Project.