Upgrade PHP 7 on Windows Server with WebPI

 Wordpress  Comments Off on Upgrade PHP 7 on Windows Server with WebPI
Jul 142019
 

I was recently working on a Windows Server which hosts a WordPress site that had been upgraded from version 4.x to version 5.3. While reviewing the WordPress Dashboard afterwards to ensure everything was working properly I noticed the warning below about PHP being out of date.  It turns out starting with WordPress 5.1 a warning will be displayed if the server hosting your site is running any version than PHP 5.7.  The WordPress team has introduced the warning in hopes of nudging site owners into upgrading PHP because PHP 7.0.x is no longer supported with new security fixes.

image

 

I was aware that PHP 7.3 had been released in December of 2018.  PHP 7.4 would be coming in November and would be the last update until PHP 8 which is scheduled for release in Q4 2020. So this seemed like a good time to upgrade PHP on the server.  In this walkthrough I will show how to determine which version of PHP is installed on a Windows server and get how to get it updated.

 

Identifying which version of PHP is installed

In case you’re not sure what version of PHP is installed on your Windows server there are a couple ways to quickly identify it. The first way would be to open IIS Manager and click on the FastCGI Settings icon. The FastCGI Settings module will show you which versions of PHP are configured.

image

 

The 2nd option is to execute the phpinfo() command from a simple .php file locally on the server. In this example the output shows PHP 5.6.31.

image

 

Upgrading PHP Using the Web Platform Installer

Microsoft’s Web Platform Installer (WebPI) is a free tool that can be installed on any Windows server most popular open source web apps and web platform technologies such as WordPress, PHP, and MySQL just to name a few. After installing WebPI simply search for PHP and you’ll be presented with a list of PHP versions and other supporting software bits like Windows Cache Extension.  In the example below I selected PHP 7.3.7 from the catalog and upon clicking Install the installation wizard presents a notification for other Perquisites that will also be installed.

image

 

The installation will proceed after clicking I Accept and the progress will be displayed.

image

 

Once the WebPI installation completes I return to the WordPress Dashboard and now see that the PHP Upgrade warning is no longer being displayed.

image

 

Running phpinfo() command again shows that the server has now been updated to version 7.3.

image

 

IIS PHP Manager

Opening PHP Manager from within IIS Manager offers a convenient way to manage the server’s PHP configuration. Clicking the menu item to Change PHP version allows you to switch between currently installed versions. This is an easy way to set the server back to an earlier version of PHP if you experience issues with the latest version deployed. Clicking on Register new PHP version allows you to manually register a new version of PHP. You would first need to download the new version to the server and then use this feature to set the path and then click Change PHP version to switch to that new version.

Double checking the FastCGI Settings also shows which versions of PHP are configured in IIS.

image

 

Manually installing PHP on Windows Server

Installing PHP on Windows Server via the Web Platform Installer is the easiest way to get the job done however the trade off is that the Web PI catalog tends to be a version or 2 behind the latest public version of the software in question. So if you need the absolute latest version of PHP installed you will have to do to manually. Installing manually requires some additional considerations. You should consult the Manual PHP  Installation on Windows Server documentation. The Non-Thread-Safe(NTS) build is intended for IIS. Additionally when manually installing PHP 7.x on a Windows Server the latest version of Visual Studio C++ Redistributable is required.

 

Uninstalling Older Versions of PHP

After upgrading PHP on Windows to a newer version you may decide to remove previous versions. It is important to note that not all versions of PHP are backward compatible and they routinely remove deprecated functionality.  So Migrating from PHP 5.6.x to PHP 7.0.x for example may have complications. Be sure to perform extensive testing before migrating to a new version and removing a legacy version.

To remove an older version of PHP simply go back to the FastCGI Settings in IIS Manager. Right click the version in question and select Remove.

image_thumb10

 

You will be prompted to confirm you want to remove it.

image_thumb13

 

Double checking the applicationhost.config will confirm that the old version has successfully be removed from IIS.

image_thumb19

 

The old binaries will still be the Program Files (x86) so manually delete those to finish removing the old version.

 

In Summary

When upgrading to WordPress 5.x you may see warning that the version of PHP on your server is out of date. The Microsoft Web Platform Installer is a powerful tool that makes it very easy to install a wide variety of open source web applications including WordPress, MySQL, and PHP 7.3. Thanks for reading.

Avatar

Peter Viola

Creative, customer focused, results oriented, Senior Web Systems Engineer who enjoys providing the highest level of customer service supporting complex Windows hosting solutions. MCITP, MCSA, MCTS

More Posts - Website

PhpMyAdmin makes MySQL Backups and Restores Easy

 Windows Server 2008, Windows Server 2012  Comments Off on PhpMyAdmin makes MySQL Backups and Restores Easy
Dec 292015
 

The Microsoft Web Platform Installer (WPI) has made installing WordPress and MySQL on your Windows servers incredibly easy. With just a few clicks one can deploy a new WordPress site in minutes.  When it comes to managing a MySQL database you may first think of MySQL Workbench which is a great tool however depending on your technical savy installing that application may be challenging.  Additionally, using it requires remote access to your server and what if you need to manage your MySQL database and don’t have access to Remote Desktop? Fortunately phpMyAdmin is a wonderful alternative with a browser-based GUI and fits any budget because it’s free.\r\n

Installing phpMyAdmin

\r\nInstalling phpMyAdmin on your Windows cloud server is easy and straight forward. Here are the basic steps:\r\n

    \r\n

  • Download the latest version of phpMyAdmin to your server
  • \r\n

  • Using IIS Manger create a site
  • \r\n

  • Unzip the phpMyAdmin archive into the root of the new site
  • \r\n

  • Using a browser go to the new site where you’ll see the login screen
  • \r\n

  • Enter your MySQL root user and password
  • \r\n

\r\nmyphpadmin-login\r\n\r\nThe current version of phpMyAdmin requires at least PHP 5.5 and MySQL 5.5. If your server isn’t running the correct specs you’ll receive an error message.\r\n\r\nmyphpadmin-error\r\n\r\n \r\n\r\nThere’s a phpinfo.php page in the root of site so you can check which version your server has in case you are not sure.\r\n\r\nimage\r\n\r\n \r\n\r\nAfter logging in with the root username and password you will arrive at the administration dashboard as seen below. From here you can perform nearly every admin task necessary to manage your MySQL instance. Adding, deleting, and editing, databases, users, and tables is only a few clicks away as well as exporting and restoring  databases.\r\n\r\nphpmyadmin-dasboard\r\n\r\n \r\n

Backing up a MySQL Database

\r\nBacking up a MySQL database with phpMyAdmin is pretty straight forward. From the admin dashboard click on the Databases menu and you will see all the databases available to your user as shown below. If you are logged in as the root user you’ll be able to select all the databases in the MySQL instance. Select the database you want to backup and click on the Export menu. Alternatively if you are already on a database’s details page, the Export menu will be there as well.  In my example I am just going to backup one user database called pvtest1.\r\n\r\nphpmyadmin-export\r\n\r\n \r\n\r\nOn the following screen you need to choose the Quick or Custom Export method. Choosing the Custom method allows you to set specific options such as reformatting the output, using compression, exporting the data as well as the structure, and Object creation options to drop existing objects when the database is restored.\r\n\r\nimage\r\n\r\n \r\n\r\nSelecting the Custom export method also enables you to specify if you want to rename the database and structure in the export file.\r\n\r\nimage\r\n\r\n \r\n\r\nUpon clicking the Go button the database will be exported to a flat file using the options you’ve selected. The file is automatically downloaded to your browser’s Downloads folder.  The text file contains serialized data so be aware that you can corrupt the contents. I have had issues restoring the files after editing them with Notepad so I prefer to use Notepad++ which hasn’t caused any issues for me.\r\n\r\nimage\r\n\r\n \r\n\r\nOne can see this is an easy and straight forward process when the occasional backup is needed. However if more frequent backups are needed, then a more robust process is required . Here is a recent blog post on how to automate MySQL backups on your server.\r\n\r\n \r\n

Restoring a MySQL Database

\r\nRestoring a MySQL database is just as simple as backing it up was. From the home dashboard click the Import menu and then choose the MySQL backup file to be imported.  By default the export file be hardcoded to create a database with the same name from which it was exported. If the export file contains the Object creation options it will drop the existing database before creating it again. As noted above you can also have the database renamed before exporting it. Additionally you can just edit the export file and specify the new database name by changing the CREATE DATABASE and USE statements. In this example we’re backing it up into a new a new database called pvtest2.\r\n\r\nphpmyadmin-import\r\n\r\nDepending on how big your backup file is the import process will take a few minutes. Once the process completes you’ll see a detailed message with the results. If there were any errors they will be noted here as well. Your new database is now ready to be used.\r\n\r\n \r\n\r\nimage\r\n

In Summary

\r\nBacking up and restoring MySQL databases on Windows Server 2012 R2 is easy with PhpMyAdmin. Previously one had to use Remote Desktop to do MySQL administration. Now using only a web browser you have nearly complete control over your MySQL databases. Thanks for reading!

Avatar

Peter Viola

Creative, customer focused, results oriented, Senior Web Systems Engineer who enjoys providing the highest level of customer service supporting complex Windows hosting solutions. MCITP, MCSA, MCTS

More Posts - Website

Apr 032014
 

Microsoft’s Web Platform Installer (Web PI) makes installing applications a breeze. In a recent blog post I covered just how easy installing IIS has become using Web PI. In this walkthrough I’m going to cover installing WordPress, PHP, and MySQL using Web PI.  I remember the days when installing these applications was a manual process. Depending on your level of expertise it was quite a challenge to get everything working properly. If you’ve ever tried to uninstall and then reinstall MySQL you know what I mean.  Now thanks to Web PI with just a few clicks of your mouse you can have WordPress, PHP, and MySQL installed on Windows Server 2012 R2 in a few short minutes.\r\n

\r\n

Setting up Your Site

\r\nOn my test server I have a new installation of Windows Server 2012 R2 with IIS 8. Using the default site you’ll see the familiar IIS 8 welcome page called IISStart.htm. This page is automatically created for the default site when you install IIS. Be sure to delete it once you deploy your files.\r\n\r\nimage\r\n

\r\n

Launching Web Platform Installer

\r\nAfter installing the IIS role on your server you’ll be able to launch Web PI directly from IIS Manager by clicking on Get New Web Platform Components . The real power and ease of using Web PI to install WordPress, PHP, and MySQL is evident after you choose WordPress and Click Install. Web PI will automatically select the other application dependencies and include them in the installation.\r\n\r\nimage\r\n\r\n \r\n

Choosing MySQL Root Password

\r\nWeb PI will prompt you to choose a password for the root administrator user for MySQL. Be sure to make a note of this password because it will be needed later and resetting the MySQL root password manually can be challenge.\r\n\r\nimage\r\n\r\n \r\n\r\nClick Accept. The installation will start running.\r\n\r\nimage\r\n\r\n \r\n\r\nWeb PI will download and install all the necessary applications. It will complete within a few minutes.\r\n\r\nimage\r\n\r\n \r\n\r\n \r\n

Configuring the site for IIS

\r\nAt this stage of the installation Web PI will prompt you to choose a few settings for the IIS configuration. You can either install WordPress on an existing site or select New Web Site. I am going to install WordPress into the root of my site so I am using “/” for the application name. If you plan on running WordPress from a subfolder then enter a name for the application. Once the required parameters have been entered you will be able to click Continue.\r\n\r\nimage\r\n\r\n \r\n\r\n \r\n\r\nYou will be prompted to enter a few unique phrases to strengthen the password security.\r\n\r\nimage\r\n\r\n \r\n\r\nOnce Web PI completes the installation process your new MySQL Database Name, Database User Name, and Database Password will be displayed on the screen. Make a note of these settings. You will need them later to log into the database.\r\n\r\nimage\r\n\r\n \r\n

Installing WordPress

\r\nOnce Web PI completes its installation process the WordPress installer will be launched. This final step of installing WordPress completes quite quickly. Enter the Site Title, the admin username and password, and your email address. Click Install WordPress to finish setting it up.\r\n\r\nimage\r\n\r\n \r\n\r\nWordpress is now ready for use. Click Log In to go to the WordPress Dashboard.\r\n\r\nimage\r\n\r\n \r\n\r\nimage\r\n\r\n \r\n

Securing WordPress

\r\nAny serious web developer or server admin knows how important it is to secure your web site.  So after I install WordPress the very next thing I do is secure it. There’s a great WordPress plugin called Limit Login Attempts which can help block automated brute force attacks to your login page.  If you wanted to take it a step further you could even use Url Rewrite to block requests except for your own IP which I chose to do when my site was once targeted by brute force attacks. One other plugin you may want to consider is called Bad Behavior. This is a great plugin for mitigating link spam and the robots that deliver it. Combined with Akismet your site’s blog post comments will be spam free.\r\n

Summary

\r\nWordpress is one of the most widely used free CMS products. Installing WordPress on Windows Server 2012 R2 also requires PHP and MySQL. Now thanks to Web PI installing WordPress, PHP, and MySQl has never been easier. Your site will be up and running in mere minutes. After installation take some extra time to secure the login page and prevent comment spam. Thanks for reading.

Avatar

Peter Viola

Creative, customer focused, results oriented, Senior Web Systems Engineer who enjoys providing the highest level of customer service supporting complex Windows hosting solutions. MCITP, MCSA, MCTS

More Posts - Website