Localhost

From phpBB Development Wiki

This tutorial has instructions for installing Apache, PHP, MySQL and running phpBB3 on your localhost. A localhost is basically a “server” running on your PC. Using phpBB3 on your localhost is a very simple process and can prove to speed up development of your website or MODs, as well as decrease possibilities for errors and decreasing downtime for your website and server. It is much faster to test local development and MOD installations than trial-and-error with FTP, waiting for your files to upload or download as necessary. I have created this tutorial to (hopefully) appeal to the least common denominator so that amateur web developers or webmasters can easily get an installation of their website and phpBB3 running on their localhost.

Contents

Using and installing your localhost

When installing a localhost, the first thing you will need is one of the following Apache packages. Although most of these packages contain both PHP4 and PHP5 versions, and some in-development, beta, or alpha versions contain development versions of PHP 5.3 and PHP 6, only the latest version of PHP5 is shown below. It is highly recommended that you run PHP5 both on your server as well as your localhost, as PHP4 has been End of Life (retired) as of January 1st, 2008. For best results, try to run similar setups (installations and versions) between your localhost and server.

All of the following packages are free except for MAMP Pro, which enables you to use MAMP in a live server environment safely -- it comes pre-configured with many additional options. Most of the other packages require some adjustments (for security purposes) for use within a server (live) environment. Please consult the user documentation for the package you wish to download and run on the adjustments needed if you plan on using a pre-built package on a live server environment.

Installing server software

Using pre-build packages

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

  • EasyPHP Apache 2.2.3 - PHP 5.2.0 - MySQL 5.0.27
    For Windows Win9x/Me/NT/2000/XP -- should work on Vista as well.

  • WampServer 2.0c Apache 2.2.8 - PHP 5.2.6 - MySQL 5.0.51b
    For Windows NT/XP and Vista.

  • MAMP and MAMP Pro 1.7.2 Apache 2.0.59 - PHP 5.2.6 - MySQL 5.0.41
    For Mac OS X 10.3.x, 10.4.x, 10.5.x PPC and Inte.l

  • XAMPP for Linux Apache 2.2.9 - PHP 5.2.6 - MySQL 5.0.67
    For Linux SuSE, RedHat, Mandrake and Debian (other versions untested).

  • XAMPP for Windows Apache 2.2.9 - PHP 5.2.6 - MySQL 5.0.67
    For Windows 2000, 2003, XP and Vista.

  • XAMPP for Mac OS X Apache 2.2.9 - PHP 5.2.6 - MySQL 5.0.67
    For Mac OS X 10.4, 10.5+ PPC and Intel.

  • XAMPP for Solaris Apache 2.2.6 - PHP 5.2.6 - MySQL 5.0.67
    For Solaris 8 and 9 (other versions untested).

  • AppServ 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 phpBB3.

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.

Creating a database for phpBB

Now that you have Apache/PHP/MySQL setup and running, test it by navigating to http://localhost 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 http://localhost/phpmyadmin or http://localhost/phpMyAdmin 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 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.


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.

Fetching phpBB3

Download the latest stable version of phpBB3 by pointing your browser to: http://www.phpbb.com/downloads/

Using Subversion

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, see the phpBB Code Forge Repository and read Installing and Updating phpBB3 via SVN for more details.

Extracting phpBB3

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/

Install phpBB3

Open your browser (recommended to use Firefox as it has more testing capabilities and is faster) and browse 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 phpBB3 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 phpBB3 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 phpBB3 installation

Updating your phpBB3 installation using the phpBB provided upgrade script package. First, download the upgrade package from phpBB Downloads (Automatic Update Package)
And... (this article is a stub, please consult: http://www.phpbb.com/support/ for instructions on updating.

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


Installing and Updating phpBB3 via SVN

Installing and Updating phpBB3 on your localhost via SVN is a simple process. Please note that Windows users will need to download and install TortoiseSVN before you can perform any of the actions below.

Open your Command-line application (cmd or Terminal)

  • Linux/Unix: use Command Line or SSH
  • Windows: program files/command line app, or use PuTTY a free SSH client
  • Mac OS X: /Applications/Utilities/Terminal.app

Type in the command to go to change directory (cd) to your webroot directory.

  • WAMP: cd C:\wamp\www
  • MAMP: cd /Applications/MAMP/htdocs/
  • XAMPP (win): cd C:\program files\xampp\htdocs

Then run the following command to download phpBB3 SVN 3.0.x branch... svn checkout http://code.phpbb.com/svn/phpbb/branches/phpBB-3_0_0/phpBB phpBB-3_0_0
This creates a new directory: phpBB-3_0_0 in your webroot.

Run the following command to update your phpBB3 3.0.x branch to the latest SVN revision... svn update phpBB-3_0_0
This command will update any file changes that have been made to the repository, add any directories or files that have been recently created in the repository, and merge any changes that have been made between the working copy (your localhost version) and the repository. The SVN update command can take between 2 seconds and 2 minutes.

You can also grab specific versions from SVN by checking out a tag, http://code.phpbb.com/svn/phpbb/branches/release_3_0_2/phpBB for example will checkout version 3.0.2.

If you wish to test the latest development of 3.1 Ascreaus (SVN trunk) you can do an SVN checkout of: http://code.phpbb.com/svn/phpbb/trunk/phpBB please note that the trunk will likely not work without some modifications. Also note that both SVN versions are completely unsupported, they should be used for testing purposes only.