Localhost
From phpBB Development Wiki
This tutorial has instructions for installing Apache, PHP, MySQL and running phpBB3 on a localhost, a server which runs on your computer. Using phpBB3 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 phpBB3 running on his 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'd (retired) as of January 1st, 2008. For best results, try to run similar setups (installations and configurations) 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.11 - PHP 5.2.9 - MySQL 5.1.33 - SQLite 2.8.17/3.3.17
For Linux SuSE, RedHat, Mandrake and Debian (other versions untested).
- XAMPP for Windows Apache 2.2.11 - PHP 5.2.9 - MySQL 5.1.33 - SQLite 2.8.15
For Windows 2000, 2003, XP and Vista.
- XAMPP for Mac OS X Apache 2.2.11 - PHP 5.2.9 - MySQL 5.1.33 - SQLite 3.6.3
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 - SQLite 2.8.17/3.6.3
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.
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() 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 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.
- 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 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/ - OS X:
/Library/WebServer/Documents/
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.
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.

