Setting up Apache
Installation

Double-click in the .MSI file to launch the installation of Apache
(Windows 98/Me users may need to install previously the MS Windows
Installer). After accepting the license, you'll be prompted for some
information: Network domain, Server name and Administrator's email.
Since this will be a test server, you can enter whatever you want, but
I recommend using your computer network name as server and domain,
since this allows accessing the server from other computers in the
local network by name instead of by IP number only. Then enter a dummy
email direction like "[EMAIL PROTECTED]" (we don't need that feature).
Regarding the options of the bottom, use the recommended option even
if you want to start the server manually (we'll see how to change this
later). Windows 98/Me users must select the second option since that
versions of Windows doesn't support system services.

Apache - Install options (1)

Then choose Custom install and remove Build Headers and Libraries,
since they are needed only for developing server extensions. You can
remove the Apache Documentation if you don't need it. Also, you can
change here the installation folder.

Apache - Install options (2)

Press Next for starting the installation. If all goes well, the Apache
service will be started and you'll notice a new icon in your system
tray: the Apache Service Monitor. This is a handy tool for managing
the Apache service: you can start, stop and restart the service from
here.

Note for Windows 98/Me users: You need to use the shortcut Start
Apache in Console for starting the server. To close the server, press
Ctrl+C on the Apache console window.
Firewall permissions

At this point, if you have running a firewall in your computer (if
not, you really should) you probably will get a notification about
letting "Apache HTTP Server" or "Apache.exe" run as a server. My
recommendations are:

    * Access/outbound permissions. You should allow Apache outbound
access to both the local network/trusted zones and to Internet, since
you could need external access for some PHP scripts (e.g. a script
that fetch an XML from another web site file for processing it).
    * Server/inbound permissions. You have to give Apache server
permissions in the local network/trusted zones (or the firewall will
block any connection attempts), but you should block the inbound
access from Internet. Since the server is only intended for doing
local tests, you don't need to expose yourself to hackers without
reason.

      Note about routers/NAT: If your Internet access is provided
through a router (using NAT), all inbound traffic from Internet is
automatically blocked, unless you configure the router to allow
inbound access on some ports. This is great from the point of view of
security but terrible if you want to allow access to the server from
Internet. If for some reason you need external access to your test
server, check your router documentation about how to map the port used
by Apache (by default port 80) to your computer.

Now if you open "http://localhost/"; in your browser you should get the
welcome page of Apache.

Now let's see how you can configure some basic server options to suit
your needs.
Server configuration file

Most of the Apache configuration is stored in the httpd.conf file
located inside the "conf" subfolder of the Apache installation folder.
There is also another file, httpd.default.conf, that contains the
default configuration of the server (very useful if you mess something
in the configuration and the server stops working).
Changing the server root folder

By default, the Apache uses as the server root the "htdocs" folder
located inside its installation folder. This is the folder in which
you need to put the files that are going to be served by Apache. If
you want to use another one, locate in httpd.conf the DocumentRoot
option and put the folder that you want to use as server's root
(surrounded by double quotes). Then move a few lines below until you
find the comment that reads "This [the following line] should be
changed to whatever you set DocumentRoot to", and follow its advice.
For example, if you want to change the server root to "D:\Web server"
you have to use the following configuration lines:

DocumentRoot "D:/Web server"

and several lines below:

<Directory "D:/Web server">

Note that in the Windows version of Apache you can use slashes or
backslashes indistinctly for path names, it would work the same (I use
slashes since it's the usual way).

Finally, restart the server to apply the changes. The next time you
access to "http://localhost/"; you should see listed the contents of
new root folder. Here you can see two captures of the server root of
one of my test machines, one from the same machine in which the server
is installed, and the other from another machine in the same local
network:

Apache web root - localhost

Apache web root - external access
Activating Apache modules

Apache uses a series of modules to extend the server capabilities
(like mod_ssl for adding support to secure connections or mod_rewrite
for URL rewriting). By default, not all the modules are loaded. If you
need to activate some of them, look for the modules section of
httpd.conf (the one that contains a lot of LoadModule lines). If the
line describing the module is commented (i.e. it begins with a "#")
that module is not active, and you need to remove the comment
character to activate it.

For example, if you want to activate the mod_rewrite module, first you
need to find the line describing that module:

#LoadModule rewrite_module modules/mod_rewrite.so

and then remove the "#" to activate it:

LoadModule rewrite_module modules/mod_rewrite.so

After this, restart the server to apply the configuration changes.
Other configuration changes

    * Changing the server to manual start. If you don't want to have
the server always loaded, double click in Apache Service Monitor tray
icon to open the main window and press the Services button. Look for
"Apache2" in the list and double-click it to get the service
properties. In the properties dialog change the start type from
Automatic to Manual and click OK. From now, the server will only be
started when you use the Start button of the Apache Service Monitor,
or the equivalent shortcut located in the Apache 2.0.xx folder of the
Start Menu.
    * Activating .htaccess files. By default, Apache doesn't allow
modify the server configuration using .htaccess files. If you want to
activate this behaviour, yo need to find in the httpd.conf the
following line:

      AllowOverride None

      and change it to:

      AllowOverride All
      Note that there is another line with the same text "inside" of a
<directory> tag. You have to change the line that is not surrounded by
other configuration parameters.
    * Addign a default character set. Although you can do this in
your .htaccess file, if you want to put a default character set for
all your pages, you can do it adding to the httpd.conf file a line
like one of this:

      AddDefaultCharset ISO-8859-1
      AddDefaultCharset ISO-8859-15
      AddDefaultCharset UTF-8
      ...
      or whatever character set you need to use.

A bit of troubleshooting

Port 80 already in use. If you receive an error message like this:

ERROR 1
<OS 10048>Only one usage of each socket address <protocol/network
address/port> is normally permitted. : make_sock: could not bind
address 0.0.0.0.:80 no listening sockets available, shutting down
Unable to open logs
Note the errors or messages above, and press <ESC> key to ext. ...

ERROR2
[Sat Oct 09 14;22:48 2004] [error] <OS2>The system cannot find the
specific
ed. : no installed service named "Apache2".
Note the errors or messages above, and press <ESC> key to exit

it means that there is another server already running on port 80 (the
default port used for HTTP connections). Only one application can
listen for connections in a given port at the same time, so if you
have active another server (like IIS), Apache can't use that port.

The solution for this is as simple as close or disable the other
program when you need to use Apache. If you don't know what program is
using that port, you can use an utility like Active Ports or TCPView
for getting the list of programs associated to any active port in the
system.

If for some reason you need to maintain the other program running in
the port 80, you can change the port number in which Apache will
listen for connections. You can use any port number that is not
already used by another program between 1024 and 65535 (e.g. 8080,
8000, 10080, 12345...). For doing that open the httpd.conf file and
find the following lines (they are located in different parts of the
file):

Listen 80

ServerName your-server-name:80

and then replace the 80 with the port number you want to use:

Listen 8080

ServerName your-server-name:8080

After this you can access to the server using the host name plus the
port number separated by a colon, like in this examples:

http://localhost:8080/
http://your-server-name:8080/

Setting up PHP
Installation

The installation of PHP is bit odd since instead of using a single
installation package you need the ZIP package and the installer
package, since the installer doesn't contain the full PHP package (but
it's useful for creating a working php.ini file easily). Also, the
part of the PHP installer for configuring Apache hasn't been finished
yet for versions 4.x, so we'll need to add some lines to httpd.conf.

First, unpack the contents of the ZIP file to the folder in which you
want to install PHP. Note that the ZIP package already contains a
folder named "php-4.4.x-Win32", so if you unpack the file in "C:
\Program Files\PHP\" the PHP files will be stored in "C:\Program Files
\PHP\php-4.4.x-Win32\". Don't use the option of not extracting folders/
pathnames or PHP won't work.

Then run the installer and select the Standard installation. In the
next panel select the folder in which you unpacked the PHP package
(the folder that contains the php.exe file). Left unchanged the panel
about SMTP configuration (SMTP won't run on Windows unless you install
an SMTP server) and in the next panel select Apache from the list of
servers. Finally, press Next to start the installation. If all goes
fine, the installer will create a php.ini file in the Windows folder
with the PHP configuration, and some directories in the PHP folder.
Changes to the Apache configuration

Before enabling the Apache module for PHP, you need to copy the file
php4ts.dll located in the PHP installation folder to the System folder
(usually "C:\Windows\System" for Windows 98/Me, "C:\Winnt\System32"
for Win2000 and "C:\Windows\System32" for WinXP).

Then you need to enable PHP in the Apache server. Supposing that you
installed PHP in "C:\Program files\PHP", you need add the following
lines at the end of the modules section of httpd.conf:

LoadModule php4_module "c:/Program files/PHP/sapi/php4apache2.dll"
AddType application/x-httpd-php .php

Finally, locate the DirectoryIndex option and add "index.php" at the
end of that line. The resulting line should be:

DirectoryIndex index.html index.html.var index.php

After restarting the Apache server, you should note that the index of
the server root now shows "Apache/2.0.xx (Win32) PHP/4.4.x" at the
bottom of the page. If you want to test the new configuration, create
a file named "index.php" in the server root folder and put inside the
following line:

<?php phpinfo(); ?>

After saving the file, if you open "http://localhost/"; in your browser
you should get something like this:

index.php showing PHP information
Activating useful PHP extensions

As well as Apache, PHP use extensions to extend its capabilities. By
default, all of the extensions of PHP are disabled. If you need to
activate a extension, look for the extensions section of the php.ini
file (it begins with Windows Extensions). Then locate the line with
the module you want to activate and remove the comment (the ";"
character) present at the beginning of the line.

Some of the extensions require additional DLL's to work. That DLL'S
are located in the "dlls" subfolder inside of the PHP folder and must
be copied your System folder prior to activating that extensions. In
the table below you can see a list of the most common extensions that
need additional DLL's:
Extension       Requires
php_curl.dll    libeay32.dll, ssleay32.dll
php_domxml.dll  iconv.dll
php_iconv.dll   iconv.dll
php_ldap.dll    libeay32.dll, ssleay32.dll
php_msql.dll    msql.dll
php_mssql.dll   ntwdblib.dll
php_openssl.dll         libeay32.dll
php_xslt.dll    sablot.dll, expat.dll, iconv.dll

For example, if you want to activate the extensions
"php_domxml.dll" (for DOM XML functions) and "php_gd2.dll" (for image
functions), you need to uncomment the following lines:

extension=php_domxml.dll
extension=php_gd2.dll

And since "php_domxml.dll" requires "iconv.dll", you need to copy that
file to your System folder.
"Hey, my old PHP code doesn't work!"

If after setting up your local server you fing that some of your code
doesn't work on it, is highly probable that you are still relying in
the deprecated register_globals option of the php.ini file. This
option has been disabled by default in PHP for more than three years
due to security issues, and consequently very few hosting providers
enable it nowadays. Anyway, a few administrators still enable it in
order to support legacy code (which is an invitation to having your
site hacked if the hosted PHP code doesn't make the proper security
checks).

The typical example of code that rely on register_globals is when you
use the data posted by a form in this way:
First file: source.php

<form action="destination.php" method="post">
  Enter your text here: <input type="Text" name="some_text">
  <input type="submit">
</form>

Second file: destination.php

<?php echo $some_text ?> // bad! relying on register_globals!

The right way of using the form variables in destination.php in PHP is
through the server superglobals:

<?php echo $_POST['some_text'] ?>

or if you use GET instead of POST:

<?php echo $_GET['some_text'] ?>

In the same way, if you need to get the document root you have to use
$_SERVER['DOCUMENT_ROOT'] instead of $DOCUMENT_ROOT. For more
information, take a look to the following pages of the PHP manual:

Superglobals variables: http://www.php.net/variables.predefined
Security issues of Register Globals: http://www.php.net/register_globals

On Sep 11, 12:37 pm, Arkesh <[EMAIL PROTECTED]> wrote:
> Hi Julian ,
>   As you had given linkhttp://groups.google.com/group/simplesamlphp
> but nobody have explained about installation ofSimplesamlphp.I even
> asked to Andreas Åkre Solberg (Author of application),but he also put
> my question in the routine blog for discussion.Till date nobody have
> answered the question.Could you help me in installingSimplesamlphp
> application at server (Not at apache localhost).I am confused about
> path setttings of config.php and configuration file of apache server.
> Regards,
> Arkesh
>
> On Sep 9, 10:05 am, "Julian (Google)" <[EMAIL PROTECTED]> wrote:
>
> > Hi Arkeshm,
>
> > In the past I used the instructions on their web 
> > site:http://rnd.feide.no/content/installing-simplesamlph
>
> > I think the group forSimpleSAMLphphas better experience with
> > installation problems, please post there if you haven't 
> > already:http://groups.google.com/group/simplesamlphp
>
> > Cheers,
> > Julian.
>
> > On Sep 8, 9:25 pm, Arkesh <[EMAIL PROTECTED]> wrote:
>
> > > Hi Julian,
> > >     Can you tell me what is the right approach for installing
> > >SimpleSamlPHP????
>
> > > On Sep 8, 12:26 pm, "Julian (Google)" <[EMAIL PROTECTED]> wrote:
>
> > > > Hi Arkesh,
>
> > > > Depending on you installation you may not need to set the VirtualHost
> > > > parameters, VirtualHost is only needed if you are running different
> > > > domains on the same server:http://httpd.apache.org/docs/1.3/vhosts/
>
> > > > The baseurlpath refers to the folder that contains yourSimpleSAMLphp
> > > > installation.
>
> > > > There is another specific group forSimpleSAMLphp, I recommend you
> > > > also to post in that group:http://groups.google.com/group/simplesamlphp
>
> > > > Cheers,
> > > > Julian.
>
> > > > On Sep 7, 4:50 pm, Arkesh <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi Everybody,
> > > > >  I  am facing problem in configuringsimplesamlphpat my computer.
>
> > > > > what i did??
> > > > > (1) i downloadedsimplesamlphpfrom follwoing 
> > > > > link.http://code.google.com/p/simplesamlphp/downloads/list
> > > > > (2) i dowloaded php 5.2 fromhttp://www.php.net/downloads.php
> > > > > (3) i downloaded apache fromhttp://www.apache.org/
> > > > > (4) i putsimplesamlphpfolder in C:\Program Files\Apache Software
> > > > > Foundation\Apache2.2\htdocs folder.My webserver working fine.
>
> > > > > According to documentation..
> > > > > ===http://rnd.feide.no/content/installing-simplesamlphp
> > > > > ===
>
> > > > > now according to documentation we have to update config.php and Apache
> > > > > configuration file (here it is httpd , C:\Program Files\Apache
> > > > > Software Foundation\Apache2.2\conf\ )
> > > > > --
> > > > > now documentation is saying something like change the apache
> > > > > configuration file as
>
> > > > > <VirtualHost *>
> > > > >         ServerName service.example.com
> > > > >         DocumentRoot /var/www/service.example.com
>
> > > > >         Alias /simplesaml /var/simplesamlphp/www
> > > > > </VirtualHost>
>
> > > > > and in config.php as
>
> > > > > $config = array (
> > > > > [...]
> > > > >         'baseurlpath'                   => 'simplesaml/',
>
> > > > > and
>
> > > > > test thehttps://service.example.com/simplesaml/
>
> > > > > This all things are seems to be confusing .
> > > > > Can anybody help me to change aforesaid files.
>
> > > > > Regards,
> > > > > Arkesh- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Apps APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to