Installing Apache, MySQL and PHP

Now it's time to install Apache, MySQL and PHP. Apache is a popular web server, MySQL is a database management system and PHP is a programming language. These are all requirements for ProcessWire.

Update Ubuntu

Before we continue, we need to make sure Ubuntu is up to date. Do not ignore this step. Run the following command and enter "y" when prompted:

sudo apt-get update && sudo apt-get upgrade

Install Apache, MySQL and PHP

Now it's time to install Apache, MySQL and PHP. While we could install each of these packages manually, we can use 'tasksel' to do it automatically. During the installation, it will prompt you three times to enter a MySQL password. I recommend keeping it blank for your development server. Just hit enter when asked. Enter the following command in Bash:

sudo apt-get install tasksel && sudo tasksel install lamp-server

Configuration

Once those are installed, we need to make a few configuration changes.

First, we need to enable 'mod-rewrite' in Apache. Run this command:

sudo a2enmod rewrite

Second, we need to install 'gd', which is used for image manipulation. Run this command:

sudo apt-get install php-gd

Third, we should install PHP zip support which ProcessWire recommends. Run this command:

sudo apt-get install php7.0-zip

Project Directory

By default, Apache is configured to serve files from /var/www/html/, which is located inside the Ubuntu filesystem. The beauty of WSL is the ability to edit our project files in Windows but have WSL/Ubuntu act as the server. Therefore we need to modify Apache's configuration files and set a new location as to the location of our files.

Run the following command in Bash:

sudo nano /etc/apache2/sites-available/000-default.conf

Change the part where is says /var/www/html to:

/mnt/c/Users/jlahijani/Projects

Now hit Ctrl-O, then Enter, then Ctrl-X.

We need to modify one more configuration file and update a path there as well, in addition to enabling htaccess overrides.

Run the following command in Bash:

sudo nano /etc/apache2/apache2.conf

Chnage the part where it says <Directory /var/www/html/> to:

<Directory /mnt/c/Users/jlahijani/Projects/>

Underneath that line, change the part where it says AllowOverride None to:

AllowOverride All

Now hit Ctrl-O, then Enter, then Ctrl-X.

Restart the Servers

With the changes made, we need to restart Apache and MySQL. Run this command:

sudo service apache2 restart && sudo service mysql restart

Previous Next

ProCache: v405 Render date: 2025-12-06 04:51:29 Page render time: 0.0735s Total w/ProCache: 0.0738s