Easier phpBB Installation

When I was first trying to install phpBB on to my systems I hated doing it remotely through FTP. Through FTP programs it was slow uploading the phpBB folder to the server. So I came up with a way that you only have to upload the compressed file to the server and run a script to extract and go through the installation right away.

What you should do first is create a directory where you want the location of the phpBB forums to be. The most common name is forums/. Then upload the compressed phpBB file to that new directory. So now the structure should look as follows:

forums/
phpBB-3.0.4.zip (depending on what version you have...in my case its 3.0.4)

Then upload the extraction php file to the same directory then run the php file. BUT first lets take a look at what the extract.php file looks like.

extract.php

  1. <?php
  2.  
  3. //a redirect function...an alternative to just using header('Location: blah.php')
  4. function redirect($location, $delay = 0) {
  5.         print '<script type="text/javascript">
  6.         setTimeout(function () {window.location = "'.$location.'"}, '.$delay.');
  7.         </script>';
  8.         die();
  9. }
  10.  
  11. //put whatever the phpbb file name is in this command...mine is phpBB-3.0.4.zip
  12. $command = 'unzip phpBB-3.0.4.zip';
  13.  
  14. if (exec($command, $output)) {
  15.         foreach ($output as $op) {
  16.                 print $op . '<br />';
  17.                 ob_flush();
  18.                 usleep(1000);
  19.         }
  20.         print '<strong>Extraction Success!</strong>';
  21. } else {
  22.         print '<strong>Extraction Failed!</strong>';
  23. }
  24.  
  25. print '<br /><br />';
  26.  
  27.  
  28. //start the second command...the extracted folder would be call phpBB3 since the current version is 3.x.x
  29. $command_2 = 'cp -v -r phpBB3/* .; rm -v -r phpBB3';
  30. if (exec($command_2, $output)) {
  31.         foreach ($output as $op) {
  32.                 print $op . '<br />';
  33.                 ob_flush();
  34.                 usleep(1000);
  35.         }
  36.         print 'Reformating Success!';
  37. } else {
  38.         print 'Reformating Failed!';
  39. }
  40.  
  41. //now go to the index page where it will redirect you to the installation set up
  42. redirect('index.php');
  43. ?>

Make sure in this block you have the right file name for the compressed phpBB file in the $command variable:

  1. <?php
  2. //put whatever the phpbb file name is in this command...mine is phpBB-3.0.4.zip
  3. $command = 'unzip phpBB-3.0.4.zip';
  4. ?>

Just like above, make sure you have the right folder name for this block:

  1. //start the second command...the extracted folder would be call phpBB3 since the current version is 3.x.x
  2. $command_2 = 'cp -v -r phpBB3/* .; rm -v -r phpBB3';

That is basically it.

Have fun,
Rashaud