Configuring the web server

From phpCMS

Jump to: navigation, search

Contents

[edit] Configuring the webserver

[edit] General information

This part of the documentation is only important for administrators of own web servers!

In order to be able to use phpCMS, a working web server is required. In addition, the server must be configured to execute php scripts, which means that the PHP-interpreter has to be installed and configured correctly. In this configuration guide we focus mainly on the Apache web server software. We are aware that there is other good web server software, which can be configured to use PHP, but due to a lack of time and manpower we will focus on setting up Apache with PHP, as this is the most common combination.

Of course - if you have some experience with the configuration of other web servers, please share your knowledge and feel free to add configuration guides for additional web servers to the phpCMS Documentation Wiki.

[edit] Installing the Apache web server and PHP

The Apache web server is currently the most used web server software. It is available for many platforms (e.g. Linux and MS Windows). Like phpCMS, the Apache web server is an open-source product.

The configuration of Apache is not as easy as you might be used to, as it requires editing a text-based configuration file. But nevertheless we are confident that the installation can be done successfully by almost any user, as the default values are sufficient for most settings, and the configuration script itself is well-commented.

As there are many good documentations and howto's covering the installation process of the Apache web server, we will only cover the necessary settings needed to get phpCMS running.

For basic Apache installation instructions please refer to the official Apache website (http://httpd.apache.org) or do a search in your preferred search engine to find one of the many Apache installation tutorials on the web.

There are also some projects which bundle Apache, PHP and other software, which usually can be found on a web server, to a package that can easily be installed. We encourage using one of these bundles if you are not familiar with the installation process of Apache and PHP. One of these projects is 'XAMPP' which can be found at the website of the Apache Friends (http://apachefriends.org).

XAMPP is an easy-to-install package with Apache, PHP, MySQL and some other software for various operating systems (Linux, Windows, Solaris..) which is also available in German language.

[edit] Configuring the Apache webserver for phpCMS

[edit] General Overview

After you installed one of the abovementioned packets (or the single software packets, depending on your skills), you have to configure Apache to provide the functionality needed by phpCMS. For this you usually need to edit the file httpd.conf. Unfortunately, this file can be found in different locations, depending on your system and setup. Using windows, take a look in your Apache installation directory (c:\apache\ or c:\Program Files\Apache\), while in linux possible locations are /etc/httpd/, /etc/apache/ or (with Apache 2) either /etc/apache2/conf/ or /etc/httpd/conf/. If you didn't find the file at either position, you can always 'search' for it.

Open the file with a text-editor of your choice (e.g. Notepad on Windows or vi on Linux) and search for a few settings that might have to be changed. Some of these settings are probably already set up the way you need them, depending on the Apache distribution you've chosen. The following is a short extract from a httpd.conf on Debian GNU/Linux. Lines beginning with # are comments that are not required and might be missing. Additionally make sure to adapt the paths given in this example to your real setup and don't just copy them from here.

...
# Important module for using stealth mode
LoadModule action_module /usr/lib/apache/1.3/mod_actions.so
...
# Load PHP modul
LoadModule php4_module /usr/lib/apache/1.3/libphp4.so
...
# Web home directory
<Directory /var/www>
...
# Allow setup using .htaccess (Stealth-Mode)
# mostly set to None
AllowOverride All
...
</Directory>
...
# Set up system to use the PHP interpreter for .php files
AddType application/x-httpd-php .php
...

The only really important setting here is AllowOverride All, which is required for using the stealth-mode. All other settings are most likely already activated, but it can't hurt to check the settings. Depending on how the used Apache executable was compiled, the PHP and action - modules might be built-in and do not need to be loaded.

[edit] Configuration needed for SuSE Linux 9.1/9.2 and Apache 2.0

SuSE 9.1 and 9.2 have the configuration files at /etc/apache2/. The default setup already includes mod_actions, and if you installed the RPM package 'apache2-mod_php4', the parsing of .php - files is already activated as well. Therefore, the only thing you need to do is edit the file default-server.conf and check for AllowOverride All.

In case you want to use the 'rewrite' module as well, you need to edit the file /etc/sysconfig/apache2, find the line APACHE_MODULES="..." and add the module name rewrite somewhere in that line.

[edit] Testing your Setup

After having set up your system this far, it's time for a little test that will ensure PHP and Apache working correctly. For this you need a small file, (e.g. named phpinfo.php) in the web directory. This file should have the following content:

<?php phpinfo(); ?>

Now open the file using an internet browser of your choice. To do this, give the address of your webserver (e.g. http://localhost/phpinfo.php or http://127.0.0.1/phpinfo.php). The resulting page should contain a lot of information about your installed PHP and Apache. Make sure to search for mod_action to ensure the module being loaded. If you get an error message instead of the PHP info page, you might want to check the single steps of this instruction again. In case you still have problems, refer to the main Apache documentation and their support forum.

As soon as all problems are solved and the combination of webserver and PHP interpreter is running, this part of the installation is done.

Main Page: User Documentation MainPage
« Previous Page: Installation and configuration | Top Page: Installation and configuration | Next Page: Configuring the PHP installation »

Bold text

Personal tools