phpBB

Development Wiki

Practical.Running phpBB3 on localhost

From phpBB Development Wiki

This tutorial has instructions for installing Apache, PHP, MySQL and running phpBB on a localhost, a server which runs on your computer. Using phpBB on your localhost can speed up development of your Web site or MODs. Development and MOD installations on a localhost do not require the repetitive cycle of FTP uploads since the entire production is on one computer. In addition, a localhost offers the opportunity to detect and prevent errors before your site is deployed live, thus decreasing downtime for the Web site and server.

This tutorial is written such that the novice web developer or webmaster can easily get an installation of his website and phpBB running on his localhost.


Installing server software

Using pre-build packages

Download LAMP / XAMPP / WAMP / MAMP pre-built packages

  • EasyPHP 13.1 VC11 Apache 2.4.4 - PHP 5.5.0 - MySQL 5.6.11
    For Windows 7/8 (For Windows 2000, XP use 13.1 VC9 version)

  • WampServer 2.4 32/64 bit Apache 2.4.4 - PHP 5.4.16/5.4.12 - MySQL 5.6.12
    For Windows NT/XP/Vista/7.

  • MAMP and MAMP Pro 2.2 Apache 2.2.22 - PHP 5.4.4/5.3.14 - MySQL 5.5.25
    For Mac OS X (min. Mac OS X 10.6.6, compatible with Mac OS X 10.7 Lion).

  • XAMPP for Linux 1.8.3 Apache 2.4.7 - PHP 5.5.6 - MySQL 5.5.33 - SQLite 2.8.17/3.7.17"
    For Linux SuSE, RedHat, Mandrake and Debian

  • XAMPP for Windows 1.8.3 Apache 2.4.7 - PHP 5.5.6 - MySQL 5.6.14
    For Vista, 7, 8, 2008 & 2012. (For Windows 2000, XP use 1.8.2 version)

  • XAMPP for Mac OS X 1.8.3 Apache 2.4.7 - PHP 5.5.6 - MySQL 5.5.34 - SQLite 2.8.17/3.7.17
    For Mac OS X 10.4, 10.5+ PPC and Intel.

  • XAMPP for Solaris 1.7.7 Apache 2.2.21 - PHP 5.3.8 - MySQL 5.5.16
    Developed and tested with Solaris 10. This version runs only on SPARC systems and not on x86 processors.

  • AppServ 2.5.10 Apache 2.2.8 - PHP 5.2.6 - MySQL 5.0.51b
    For Windows NT, 2000, 2003 and XP.
    If you use Windows 9x or ME is recommended to use a version below 2.0.x

Install Apache Package

Once Downloaded, install one of the above packages, making sure to follow the instructions. Be sure to remember what directory it uses for it’s “webroot” such as www, public_html, or htdocs etc...
Average time needed to install an Apache package is about 15 minutes.

Be sure to consult the User Documentation regarding your pre-built Package for configuration instructions. Check to ensure the Apache/MySQL ports are set to 80/3306 -- some may be set to 8888/8889 (for example). Please note that applications such as Skype can conflict with these default ports (80 and 3306). For Mac OS X: ensure Web Sharing is turned OFF in System Preferences.
Most of the pre-built packages preferences/options allow you to choose which PHP version to run. We strongly recommend running PHP5. Although you can test either version, you should choose the version that your server is using.

Start localhost Apache/MySQL Services/Server

Once installed, start your servers (or “web services”).

  • MAMP -- OS X: Use the MAMP Widget or MAMP.app to Start Servers;
  • WAMP -- XP & Vista: Click the services icon in the lower right-hand corner, and select “start all services”

If your services do not start, try exiting all applications and/or restart your computer. You may be experiencing a port conflict.
Every time you start up your computer, you’ll have to start your localhost services/server again to run your localhost on your computer. However, some packages may contain details on how to setup startup files to start the servers/services on computer startup. -- Consult the user documentation for details.

Any changes that you manually make to the php.ini or httpd.conf files will require you to restart (stop and start) your Servers/Services.
MAMP Pro, contains it’s own server config templates located in /Applications/MAMP\ PRO.app/Contents/Resources/ which can be accessed and edited through the file menu in the application. Most other packages these configuration files are located within a conf/, php/ or apache2/conf/ directory.
In the php.ini file, set error_reporting to error_reporting = E_ALL and display_errors to display_errors = On Be sure to note the location of the error log files... error_log or error.log which you will need for debugging some types of any errors you may find when developing your website or phpBB.

Using operating system package manager

For most Linux distributions there is an easier and better way of getting a LAMP stack set up, instead of using pre-built packages you can use the packages provided by your vendor.

Debian/Ubuntu

This might work for other Debian or Ubuntu derived distributions.

  • sudo aptitude install apache2 libapache2-mod-php5 phpmyadmin mysql-server php5-{gd,mysql,mhash}
  • You will asked to give a new password for the root MySQL user, enter one and remember it.
  • Next you will be asked which web servers phpMyAdmin should be configured for, tick 'apache2' by pressing space.
  • Now the installation should take place.

You can access phpMyAdmin at http://localhost/phpmyadmin/ and the directory served by the web server is /var/www/. If you want to install phpBB using Subversion then you can fetch the SVN client by doing sudo aptitude install subversion.

=== Installation on Mac OS X ===

If you are using any version of OS X (Client or Server) then some key parts of the web server are already installed: Apache, and PHP. All you need to do is activate these two, and then install MySQL. This section for OS X has been written assuming that you have either 10.4 (Tiger) or 10.5 (Leopard) installed. Older versions of OS X do include PHP and Apache, but they are older versions and undesirable.

Enabling Apache and PHP

As the root user, you need to edit the Apache httpd.conf file. With your favorite line editor, (I use TextEdit) open this file: /etc/apache2/http.conf

Now scroll down until you get to the modules section. Find this line:

# LoadModule php5_module

And remove the #. What are you doing here is un-commenting that line, thus allowing PHP to be loaded. Save and close the httpd.conf file.

Now in the System Preferences, click Sharing, then check the box for Web Sharing. In a few moments, Apache should be loaded up.

Open Safari (or whichever browser you use) and go to http://127.0.0.1/

If everything went OK, you should see an Apache web page.

Installing MySQL

The client version of OS X does not include MySQL, so you must download it here: http://dev.mysql.com/downloads/mysql/5.1.html#macosx-dmg

The latest major release of MySQL is version 5.1. It's generally best to always stay current with PHP and MySQL versions.

Which version to download? If you have an Intel Mac, choose x86_64. If you have a G5, choose PowerPC 64-bit. If you have any other Mac, choose PowerPC 32-bit. Make sure you are downloading the package version. This will include the friendly OS X Installer interface. Once you have downloaded MySQL and have opened the package, the installation is automatic.

In the System Preferences, a new Preference Pane for MySQL will be added. You can use this Preference Pane to stop or start the MySQL server. Make sure MySQL is running as soon as you start up your Mac.

Installing phpBB or other scripts

Now that you have the 3 main components of a modern web server, it's time to start serving some scripts. By default, Apache serves files from /Library/WebServer/Documents/

The Apache test page is located in this directory. To make a PHP test page, make a new file with this code <?php phpinfo()</code]> and save it as test.php. If you access http://127.0.0.1/test.php and see the PHP configuration page, then you are all set.

Download phpBB 3, copy it to /Library/WebServer/Documents/, unpack and install it, and see if it works.

Creating a database for phpBB

Now that you have Apache/PHP/MySQL setup and running, test it by navigating to <code>http://localhost</code> in your browser. This should bring you to an index page stating that you have successfully installed your Apache/PHP/MySQL Package. To access your Database Manager, you can utilise the pre-installed phpMyAdmin. An alias is located in each package, or try browsing to <code>http://localhost/phpmyadmin</code> or <code>http://localhost/phpMyAdmin</code> depending on your package), I recommend that you grab a copy of Navicat or similar GUI Database Administration Tool. (it can speed up your development/testing time by 400%-500%)

Create a new Database, in this example, we’ll name it <code>phpbb_phpBB3. -- Consult the documentation for the database admin tool or phpMyAdmin on how to create a new Database.

  • Navicat: File menu > Connection > New Database.
  • phpMyAdmin: type in the name of the new database in the “Create new database” field.
  • MySQL Monitor: mysql> CREATE DATABASE phpbb_phpBB3;


Now create a new user (and unique password) and give that user permission (privileges) to access all aspects of the database. (Select, Insert, Update, Delete, Create, Drop, References, Index, Alter, etc).

  • Navicat: Manage Users (Icon) > Add User > (fill username, Host: localhost, password) > Select User > Select phpbb_phpBB3 Database > Click Set Privilage > Select All :: Close.
  • phpMyAdmin: (from home) > Privileges > Add a new User > (fill User name, Host: localhost, password) Here decide if you want to give the user global permissions, or permissions based on the database name. You can name the user “phpbb” and Grant all privs to wildcard name and it will have all permissions to your phpbb_phpBB3 database. > Go.
  • MySQL Monitor: mysql> CREATE USER 'phpbb'@'localhost' IDENTIFIED BY 'password'; GRANT ALL ON phpbb.* TO 'phpbb'@'localhost';

Fetching phpBB

Download the latest stable version of phpBB by pointing your browser to: https://www.phpbb.com/downloads/#install

Using Git

If you are a developer or MOD Author and wish to test a development version of phpBB or your MOD (or style) with the next release of phpBB 3.0.x, the development code repository is at GitHub, View on GitHub. More information about using Git for phpBB development is at Git.

Extracting phpBB

After unzipping your phpBB download, drag the phpBB3 directory to your localhost web root directory

  • WAMP: C:\wamp\www\
  • MAMP: /Applications/MAMP/htdocs/
  • XAMPP (win): C:\program files\xampp\htdocs\
  • Debian/Ubuntu: /var/www/
  • OS X: /Library/WebServer/Documents/

Install phpBB

Open your browser and go to http://localhost/phpBB3

Since the config.php file is empty, you will be redirected to the http://localhost/phpBB3/install/. You may now proceed to install phpBB into your localhost using your newly created Database and Database user.

Once installation is complete, edit your config.php file and enable DEBUG and DEBUG_EXTRA (removing the double slashes). This enables your board to run with the /install/ directory in place. It is not necessary to remove this directory on your localhost. However, be sure that you don’t accidentally upload it to your live server.

Congratulations! You have successfully installed phpBB onto your localhost. If you plan on using the SVN versions, you may continue to read the rest of the tutorial. Or see the next step for instructions on updating your phpBB 3.0.x installation to the latest version.

Updating your phpBB installation

There are several ways to update your phpBB installation, see INSTALL.html

The various update packages are available from Download phpBB

This article is a stub. You can help in improving Olympus Documentation by expanding it.