Installing PHPBB forums on Windows Server 2012 and SQL 2012

Posted: February 25, 2013 in IIS, Information, SQL, Windows General
Tags: , , , , ,

My Adventures with PHPBB running on an all Microsoft platform began many years ago. Much trial and error resulted in the first forums with V2. When they released V3 there was a much improved situation with documentation and guides, but it was still a tough thing to get right. It’s a community that favours Linux/Apache/MySQL, so getting assistance for Windows/IIS/MSSQL is pretty tough.

This time around I’m starting a completely fresh install on Windows Server 2012, with IIS 8, and MSSQL 2012. I’ve been “upgrading” over the years and have completely forgotten all the tweaks I needed to make it work, so that as well as dealing with any new “features” of the latest MS software is why I’m writing this entry.

Notice that while I am using the Web Platform to install PHP, I do not use it to install the phpBB forum software. I found too many issues with the additional pre-requisites it needed to install and also had problems with it wanting to use MySQL instead of MSSQL.

This is a very simple and *BASIC* installation. I am not explaining how to make this accessible from the internet (yet) so you will need to know how to publish the website through router etc.

First, prepare the SQL server:

  1. Install SQL, either on the same server or a remote server
  2. Open SQL Server Management Studio
  3. Make sure SQL has SQL authentication enabled
    1. Right click the database server and select Properties
    2. Open the security page and check that “SQL Server and Windows Authentication mode” is selected
    3. phpBB requires SQL Authentication. phpBB won’t use Windows Authentication, although Windows Auth can be enabled for other systems that also connect to the SQL server.
  4. Right-click the Database node and select “New Database”
    1. Enter the name for the new database (e.g. phpBB_Forum)
    2. Click OK to create
  5. Expand the Security node, right click and select “New Login”
    1. Enter the name to use for your phpBB connection (e.g. svc_phpBB)
    2. Select the “SQL Server authentication” option and enter the password to use
    3. Untick the “Enforce password policy” option
    4. Set the “Default Database” to the new database created
    5. Select “User Mapping”
    6. Tick the new database and then tick the “db_owner” role
    7. OK/Apply all changes

Install IIS and PHP

  1. Open the “Add Roles and Features” wizard
  2. Select the “Web Server (IIS)” Role.
    1. Under the role, expand “Web Server | Application Development” and tick the option for CGI
    2. Complete the installation and agree to any other components that are auto-selected
  3. Complete the wizard, no other components are required
  4. On a workstation (the server has to many limits enabled for web bvrowsing) download the WebPlatform Installer
    1. http://www.microsoft.com/web/downloads/platform.aspx
    2. Click “Free Download” and select “Save-As” to save the wpilauncher.exe file
    3. On the server, run the wpilauncher.exe (it will only take a few seconds and then exit)
  5. Open Internet Information Servers (IIS) Manager
  6. Select your server
    1. If asked to get started with the Microsoft Web platform, tick the “Do not show this message” and click No
  7. Click the “Web Platform” icon under Management (or the Get New Web Platfom Components” under the Actions window)
    1. Wait a minute or two for the Web Platform Installer to prepare the catalogue
  8. In the search box, type “php” and enter
  9. Locate the latest entry for “PHP” (e.g.PHP 5.4.14 as at 16/6/2013) and click Add, then click Install
  10. Accept the conditions and wait for the installation to download and complete
    1. (To be updated:) PHP does not include the MSSQL native drivers, see note at the end of this blog post for download link
  11. Download the latest version of Imagemagick (used to create attachment thumbnails and other graphics)
    1. http://www.imagemagick.org/script/binary-releases.php#windows
    2. The preferred version is the “*x64-dll.exe” version
  12. Run the Imagemagick installer
    1. Accept defaults, and add application directory to your system path
    2. Make a note of the install location

Now install phpBB

  1. Download the latest version ZIP file https://www.phpbb.com/downloads/
  2. Extract the files and copy the phpBB3 sub-directory to the place you want to use for your website directory location (e.g. c:\inetpub\phpbb3)
  3. In IIS Manager, expand the “Sites” node and right click the “Default Web Site”
  4. Select “Add Virtual Directory”
  5. Enter an Alias for the directory (e.g. Forums) and set the Physical Path to the location you copied the files to (e.g. c:\inetpub\phpB3)
  6. Using Windows Explorer, browse to the folder location where you placed the phpBB directory (e.g. c:\inetpub\phpbb3)
    1. Right click phpbb3 folder and select properties, under Security, add the local computer user “IUSR” and grant read access
    2. On phpbb3\cache folder grant IUSR Modify permissions
    3. On pbpbb3\files folder grant IUSR Modify permissions
    4. On pbpbb3\store folder grant IUSR Modify permissions
    5. On pbpbb3\images\avatars\upload folder grant IUSR Modify permissions
    6. On the pbpbb3\config.php file grant IUSR Modify permissions (this is TEMPORARY. Be sure to follow the step later to remove this permission!)
  7. Using your web browser, connect to the new website (e.g. http://[servername]/forums)
  8. Select the “Install” tab and click “Proceed to next step”
  9. Confirm all components and access are good and click “Start Install”
    1. Correct any issues and click “Try Again” to retest the settings
  10. For database Type, select “MSSQL Server 2005+ [Native]”
  11. Enter the details for the database server name and the SQL user details created earlier
  12. Continue to “Administrator Details” page and enter the details as requested
  13. Continue to the “Advanced Settings” page. Leave settings default, but check the “Domain name” is set to the servername instead of “localhost”
  14. Continue to create the database tables and complete the main installation
  15. Delete the Install folder (e.g. c:\inetpub\phpbb3\install)
    1. If for some reason it is needed again, it can be copied from the original download extract
  16. In Windows Explorer, open properties on the “config.php” file, select IUSR and click Remove
    1. After clicking remove, the entry for ISUR will still be showing and will be greyed out again to indicate only the inherited read permissions. This is the correct setting
  17. Return to the Install page and click the “Login” button to login to your new forum
  18. If you open the Administrative Control Panel, then go to Attachment Settings, you can copy/paste the path to your Imagemagick folder location as required

Now you can start creating your forums, groups, permissions etc. and with enough tweaking get something that might look like this. I don’t think I’m the best person to talk about all that, but check out the community resources at www.phpbb.com for lots of tips.

NOTES:

Comments
  1. Simon says:

    I’ve just started doing the same thing, currently getting issues authenticating to the db. How’d you go, any useful outcomes?

    • Simon says:

      Found my issue was that it requires SQL auth not Windows auth.

      • Scott says:

        Yup, you beat me to answering. Yes. SQL auth unfortunately. I am working on getting it working with Windows Auth so can post that if/when I get around to it.
        I never updated the post beyond its current form coz you are the first person who seems to have been interested.
        I’ve been running PHPBB on Windows/MSSQL/IIS for a long time now, so let me know if you get stuck and I’ll see if I can help.

  2. Scott says:

    Finally got around to finishing the walk-through guide.

  3. jaychenfeng5 says:

    You can try [edit:removed name of free forum host] forum, pretty easy to use and its free.

    • Scott says:

      There are plenty of “free” forum hosts around that you can use to setup a quick forum, but that is not the purpose of this guide. Being able to host my own forums is a great learning experience and also give me a lot more flexibility. I don’t have issues with the forum host closing down unexpectedly. I can create and access my own backups, add whatever mods or tweaks and upgrade and set security how I like.
      The host forums are handy, but are also very limited, so it all depends on what you are looking to do. If you want to setup a free forum, go for it.

  4. Cameron says:

    I am actually setting up this exact environment and wondered if you were ever going to add the part about getting the phpBB fully working:
    “This is a very simple and *BASIC* installation. I am not explaining how to make this accessible from the internet (yet) so you will need to know how to publish the website through router etc.”
    The “(yet)” made me hopeful but I understand that you haven’t had much traffic to this post.
    Still, I would very much appreciate any help you can provide.

    P.S. – Your blog is full of excellent and helpful information!

  5. Cameron says:

    Things were going smoothly until I reached step 10 on installing phpBB:
    10.For database Type, select “MSSQL Server 2005+ [Native]“

    During Step 9, phpBB shows Unavailable for MSSQL Server 2005+ [Native]
    but it does show Available for MSSQL Server 2000+ via ODBC

    If I attempt to go ahead with the installation, “MSSQL Server 2005+ [Native]“ is not even an available option to choose.

    Any help you can give would be greatly appreciated.

    Thank you,
    Cameron

    • Scott says:

      The first thing that occurs to me is checking that you have the SQL extension enabled in PHP. Check your php.ini file at the end where the extensions are. The last two lines in mine are;

      extension=php_pdo_sqlsrv.dll
      extension=php_sqlsrv.dll

      However, as soon as I typed that a thought occurred to me that those files aren’t included with php by default. I don’t know why I didn’t include that in the post, but it looks like I’ll have to recheck all of that. It was all a while ago now

      Try this link for the files and see if that helps: http://www.microsoft.com/en-us/download/details.aspx?id=20098

      FYI – I’ve just added a couple of quick notes to the post. Let me know if it helps.

  6. Cameron says:

    FINALLY!!!

    So first of all, your instructions were very helpful because they made it clear that I was going in the right direction as I had already downloaded the SQL Server for PHP drivers and inserted the proper lines into the php.ini

    For any future installers, my problem was rooted in a bad PHP install. I had used WPI to install the latest PHP I could find which was 5.5.8

    To fix, I removed the 5.5.8 install and instead installed PHP 5.4.24 which included the neccessary SQL for PHP drivers and additions to the php.ini file.

    I then proceeded with the steps outlined in this blog:
    7. Using your web browser, connect to the new website (e.g. http://%5Bservername%5D/forums)
    8. Select the “Install” tab and click “Proceed to next step”
    9. Confirm all components and access are good and click “Start Install” 1.Correct any issues and click “Try Again” to retest the settings
    10. For database Type, select “MSSQL Server 2005+ [Native]“

    This time, I could the MSSQL Native installation and complete the installation successfully.

    Thank you so much for you help!!
    ~Cameron

    • Scott says:

      Glad to hear it. I just checked and I’m still running php 5.4.9. I wonder if there needs to be a newer mssql driver for the newer php or if the phpbb software isn’t ready for 5.5 yet.

  7. Great post, this was exactly what I was looking for. Couple quick additions…the version of the Web Platform Installer I used (I believe 4.6) included PHP 5.5 and also included what were listed as SQL drivers for PHP. Installing both did not work. After some research I’ve confirmed there are no native-mode SQL drivers for PHP 5.5, so using PHP 5.4 is necessary. The drivers also need to be manually installed per your links, NOT theWeb Platform Installer, and the php.ini file updated to include the extensions as follows:

    extension=php_sqlsrv_54_nts.dll
    extension=php_sqlsrv_54_ts.dll

    Hope this helps, and thanks again.

    • Scott says:

      Thanks for that.

      I’m still running PHP 5.4.9 so hadn’t come across the issue with the latest PHP and SQL.
      I haven’t really spent much time updating this post, and given you seem to be about the third person to use it I’m guessing its not a common combination🙂

      Thanks for the updates, I’ll get around to adding them into the post, or maybe just mention at the top to read the comments for newer changes.

  8. Hi Scott,
    You’ve been a tremendous help to me over on the MS site, and I’m taking you up on your offer to help further. As a reminder, I’ve ran .asp forums on Access DBs for a decade but now need something faster. I’m completely new to SQL, php and phpBB.

    At this point I’ve started fresh with a clean install. The last install I couldn’t get past installing the Native drivers. I added:

    extension=php_sqlsrv_53_ts.dll

    to the last line of my php.ini and restarted the server. It made no difference what-so-ever; it still did not list the native option during the install of phpBB. I’ve also tried manually installing PHP and even MySQL to try to get a functional forum and failed. Windows Platform installed 64bit versions of everything and I don’t know if this is compatible with PHP? If I install phpBB using the Platform installer on a local machine I get a functional forum but don’t want to go that route on my leased server in the data center because I want more control over the installation options.

    Could you go into a little more detail on the installation of the Native drivers 3.0?

    Thanks, Scott!

    • Scott says:

      Hi Nathan,

      I had a lot of problems using the Windows Platform installer with PHPBB as I mention in the post, that was why I did it the way I did. It may have improved since then, but I haven’t tried.
      Have you read through the comments at the end as there are several mentions of people needing to do different things for the SQL drivers. When you add the entries to the php.ini, just check the name you are using matches the actual name of the DLL that the driver installed. Is php_sqlsrv_53_ts.dll the correct name?
      Also, what version of php did you install? I’m not sure if the current SQL drivers work with v5.5 or above.

  9. Scott,
    I erased everything and started over. This time I installed PHP version 5.4 with the Platform Installer. The installer also gave me the options of installing the Native drivers for me. I now have a functional forum and I am now learning the phpBB software and am moving forward to rebuild all of my servers using the phpBB.
    Your tutorial here as well as the additional help has been invaluable to me and I cannot thank you enough for all the help!
    I plan at this point to run all my forums on one instance of MS SQL. If I find that its not fast enough due to the limitations of Express I’ll either upgrade to a paid version or be back for more help with moving a DB from one instance to another.
    Thanks again man, your work enabled me to do this!

    • Scott says:

      No problem, glad it helped.
      As for SQL performance, you would have to be running some really busy forums for SQL to be the limitation. If your server has enough capacity it should handle it easy.
      If it does come to it though, moving to a new SQL server is pretty easy.

  10. Any chance you have a step by step guide for setting permissions in phpBB3?

    • Scott says:

      no. Permissions are still a thing I struggle with as well. It really does seem to be amazingly complicated. Vastly improved over phpBB2… but so confusing.
      I have got them worked out pretty well on my own forums, but it took a lot of hit and miss, and using the “test permissions as…” function to check the results.
      Luckily permissions are something that is the same regardless of the platform, so there may be guides other people have or on the phpbb forums.
      My only tips are as above – Use the “test permissions as” function, and also make sure to test as the unregistered user profile. At one point I made changes that worked fine for all registered users of different levels without realising I had left it all readable to unregistered users.

  11. mike says:

    hello there, I followed your instructions to the T and managed to get it all working thank you for that, only problem is my forum is all mis aligned and search icons etc are not there? is this due to the latest version do you think?

  12. Nice guide. I have successfully followed along twice. I was wondering if you had and ideas on how to move the db and site to a new iis server and SQL db?

    • Scott says:

      (sorry for the late reply) It’s quite easy. Just dismount the database, copy the files to new location and remount. Then copy the PHPBB folder to new location, create new website (and settings as per blog). Edit the config.php in the root of the phpbb folder with the new SQL server.

  13. ajtouchstone says:

    Hello. I’m trying to install the latest phpBB3 on Microsoft IIS and MySQL. All the checks go through and I have the permissions on the folders set correctly. It passes database checks and even puts data into the database. But on the final step, the installer throws an HTTP 500 error and I cannot figure out why. The site is mostly installed, but generates a PHP error if I try to log into the ACP. Any ideas? Thanks.

    • Scott says:

      When it throws an error you usually see the line in the install script it failed on which can give an idea of why.
      When you login to ACP, again the line it fails on can give an idea of what is wrong.
      Have you checked permissions on the PHP folder are correct? The phpbb support forums are good for checking if other people report similar errors.

  14. Vansh says:

    Hi, I am trying to install Microsoft SQL 2012 on Windows 10 OS but the setup terminates after first four steps. Unable to figure out reason for the same.

    • Scott says:

      What version/edition of SQL and why install it on Windows 10? Have you check supported requirements?
      What are the first four steps you are referring to? Is there no error message or reference to the setup log?

  15. Scott,
    I’ve ran my forum for two years successfully, and tried to update the software today to the latest version. The update locked up on me and in the process I lost my forum. I still have the DB intact as well as the config.php and the images folder. I’m attempting a clean install but now when I attempt to install a virtual directory for the forum I get the “Cannot verify access to path” warning. When I attempt to access the new forum software I get a 500 – Internal Server Error. If I put a .jpg file in the directory mydomain.com/1.jpg I can pull up the .jpg in my browser, but if I copy over the forum software into the same directory, the .jpg will no longer display in a browser. If I delete the forum software from the folder, the .jpg will appear again. Any help on this sincerely appreciated. I had successfully converted 10 years of work into this forum two years ago and everything has been fine, but now I’m afraid of losing it all. I realize at this point I have an IIS issue and I’m hoping you have the fix for it?
    Thanks,

    • Scott says:

      I guess the first thing I’d suggest is check the permissions on the folder are correct and that the account used by the IIS AppPool has access and IUST has read and execute file permissions.
      When you copy in the software, is it from a backup or a brand new copy? Check the files aren’t “blocked” by right-clicking the files and see if properties shows an “unblock” option.
      I haven’t done a clean install for a while now, but I haven’t done anything different from the instructions in this post that I can recall.

  16. Andrew J. says:

    This tutorial is super usefull for college project

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s