This article describes how to setup Drupal and configure Apache, MySQL or PostgreSQL, PHP, and Postfix to work with it. It is assumed that you have some sort of LAMP (Apache, MySQL, PHP) or LAPP (Apache, PostgreSQL, PHP) server already setup.
- 1 Installation
- 2 Tips and tricks
- 3 Troubleshooting
- 4 See also
- If PHP version is less than 5.2.0, Find the line with
;extension=json.soand uncomment it by removing the ";" from the beginning of the line if necessary. If no such line is found, add it to the
[PHP]section of the file.
- For Drupal 7, enable a PDO extension for your database. For MySQL, the line
extension=pdo_mysql.soshould be uncommented.
- Find the line beginning with
open_basedir =. Add the Drupal install directories,
/srv/http/can be removed if you do not intend to use it.
- If your webserver is dedicated to Drupal, find the line
DocumentRoot "/srv/http"and change it to the Drupal install directory, i.e.
DocumentRoot "/usr/share/webapps/drupal", then find the section that starts with "
<Directory "/srv/http">" and change
/srv/httpto the Drupal install directory,
/usr/share/webapps/drupal. In the same section, make sure it includes a line "
AllowOverride All" to enable the clean URL's.
- If you are using Apache Virtual Hosts, see Apache#Virtual_Hosts.
Finally comment out the
deny from all line of the
/usr/share/webapps/drupal/.htaccess file to enable httpd access and restart Apache (httpd).
Download the latest package from http://drupal.org and extract it. Move the folders to Apache's htdocs folder. Open a web browser, and navigate to [localhost localhost]. Follow the on-screen instructions.
You may need the GD library for your Drupal installation. First install the
/etc/php/php.ini. Find the line with
;extension=gd.so and uncomment it by removing the ";". If no such line is found, add it to the
[PHP] section of the file.
Restart Apache (httpd).
In order to send e-mails with Drupal, you will need to install Postfix. Drupal uses e-mails for account verification, password recovery, etc. First install .
- Edit Postfix configuration file
/etc/postfix/main.cfas needed. All that you should have to do is change the hostnames under "Internet Host and Domain Names"
myhostname = hostname1
- Start the Postfix service:
# systemctl start postfix.
- Send a test e-mail to yourself:
mail myusername@localhost. Enter a subject, some words in the body, then press
Ctrl+dto exit and send the letter. Wait 10 seconds, and then type
- Make sure port 25 is fowarded if you have a router so that mails can be sent to the Internet at large
- Edit the file
/etc/php/php.ini. Find the line that starts with,
;sendmail_path=""and change it to
sendmail_path="/usr/sbin/sendmail -t -i"
- Restart the Apache web server.
Tips and tricks
Scheduling with Cron
Drupal recommends running cron jobs hourly. Cron can be executed from the browser by visiting [localhost/cron localhost/cron]. It is also possible to run cron via script by copying the appropriate file from the "scripts" folder into
/etc/cron.hourly and making it executable.
The 5.x and 6.x series of Drupal do not support PHP 5.3, and as a result are incompatible with the latest release of Xampp. Currently, the last Drupal-compatible version of Xampp is 1.7.1.
Note: Xampp's PHP memory limit currently defaults to 8MB. Also, Xampp ignores php.ini files in the Drupal directory. To fix this:
- Edit Xampp's configuration file
/opt/lampp/etc/php.iniusing your favorite editor.
- Search for the "memory_limit" line, and replace it with an appropriate value. Most Drupal installations just need 32MB, but sites with a lot of modules may need 100MB or more.
- Restart Xampp:
Upload progress not enabled
Upon successful installation you may see the following message in the Status Report:
First, install thepackage. Next, use the pecl command to automatically download, compile and install the library:
# pecl install uploadprogress
Finally, add to
Browser shows the actual PHP code when visiting localhost
You do not haveinstalled.
Then, enable the PHP module in
/etc/httpd/conf/httpd.conf by adding the following lines in the appropriate sections:
LoadModule php5_module modules/libphp5.so Include conf/extra/php5_module.conf
If, when starting httpd, you get the following error:
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
You should edit
In that file find the line that looks similar to
Uncomment it (remove # from the front) and adjust the address as needed. Restart httpd:
# systemctl restart httpd
Setup page is not the initial page when accessing localhost
In this situation, you should navigate in your
/srv directory and look for the
drupal folder (most probably it will be in the
http directory). Then edit
and look for a line starting with
DocumentRoot and change the path with that folder's path (for example
DocumentRoot "/srv/http/drupal") and also find another line starting with
<Directory and set the same path there as well. Restart httpd.
Setup page does not start and shows HTTP ERROR 500
This may be because Drupal needs the
json.so extension to be activated in your
Just uncomment in
/etc/php/php.ini the line:
Restart httpd service.
See this link for info.