- Localhost/phpinfo.php was IIS. Localhost:4782/phpinfo.php was IIS Express. Visual Studio (VS) was running the Joomla site on PHP version 5.3 because VS was using IIS Express. I needed VS to use IIS instead, which uses PHP version 7.2.7. I also maintained both versions of PHP were configured correctly. However, the focus on PHP misled me somewhat.
- It can also include a port number. 'hostname:port' or a path to a local socket e.g. ':/path/to/socket' for the localhost. If the PHP directive mysql.defaulthost is undefined (default), then the default value is 'localhost:3306'. In SQL safe mode, this parameter is ignored and value 'localhost:3306' is always used.
Consider installing PHP in a folder that indicates the version (“C:PHP7.2” instead of “C:PHP”) so that different sites can rely on different versions of PHP. There’s a lot more to running PHP on IIS, because of the power of both platforms (just like there are many possibilities when running PHP. Check PHP Version (CLI) By default there can be one default PHP version can used with standard binary. To check PHP version currently active on command line, execute the following command on terminal. It can also include a port number. 'hostname:port' or a path to a local socket e.g. ':/path/to/socket' for the localhost. If the PHP directive mysql.defaulthost is undefined (default), then the default value is 'localhost:3306'. In SQL safe mode, this parameter is ignored and value 'localhost:3306' is always used.
Our servers support PHP 7.0 and higher. PHP versions 7.2 and higher offer a significant improvement to speed and memory usage over past PHP versions. It also comes with better error handling and many bug fixes.
Before making the switch, you need to be aware of backward compatibility issues with scripts: Older PHP coding may not be compatible with newer PHP versions. Avoid skipping versions, and instead, make updates incrementally. It is important to check first the compatibility of your site against new versions of PHP before upgrading. Sites built with WordPress can use the PHP Compatibility Checker plugin. You can also check PHP Manual for reviewing the new and deprecated features of PHP.
Pro Tip: In addition to making sure you have the latest PHP, make sure your data and files are also protected in the event of accidents, data loss, or hackers with CodeGuard. Ensure you have a daily backup of your site for easy restoration. To know more information about this process, please see: Getting CodeGuard Set Up for Backups or How To Backup & Restore WordPress Using WordPress Tools.
The process for updating your version of PHP will depend on what type of account you have set up. Older accounts use the Legacy interface, while updated accounts will use the Bluerock interface.
Most customers should use Bluerock instructions. If you are unsure whether to use Bluerock or Legacy, please see this article Bluerock vs. Legacy. It will show you the difference between the two interfaces.
How to Change Versions Using PHP Config (Legacy)
You can change your PHP version in Legacy accounts by following these steps:
- Log in to your Bluehost control panel.
- Under the Hosting tab, click cPanel in the submenu.
- Scroll down and look for the programming section, then click the PHP Config.
- Select the version of PHP you're interested in using.
- Click Save Change.
Note: This option only works with Legacy Account. Please see below for Rock Instructions.
How to Change Versions Using MultiPHP Manager (Bluerock)You can change your PHP version in Bluerock accounts by following these steps.
- Log in to your Bluehost control panel.
- Click on the Advanced tab from the side navigation menu to the left.
- In the SOFTWARE section, click MultiPHP Manager.
- Check the box next to the website(s) this PHP version will apply to.
- Choose the PHP Version, then click Apply.
How To Open Localhost
Please note: If a domain is set to Inherit, it will automatically take on whatever PHP setting is assigned to the main domain.
To generate a new php.ini file:
- Log in to your Bluehost control panel.
- Under the Software section, clickMultiPHP INI Editor.
- Select the path by clicking on the drop-down menu under Selecting a location.
- Choose the domain name.
- Once you're done, scroll down and click Apply.
Note: If you have any further questions about configuring the php.ini file, there are extensive descriptions within the file itself. You may also find more help at http://www.php.net/docs.php.
What is php.ini?
The php.ini file is the default configuration file for running applications that require PHP. It is used to declare settings and control variables such as upload sizes, file time-outs, resource limits, etc.
Your server is already configured with standard settings for PHP, which your site will use by default. Unless you need to change one or more settings, there is no need to create or modify a php.ini file.
Note: If you would like to make any changes to these settings, please do so through the MultiPHP INI Editor. To know more about the process, please see: How To Configure The PHP Environment With PHP ini.
Things to Keep in Mind
If you are using a custom php.ini file that references PHP modules that are not available in your selected version, your site may not work. Either remove the custom php.ini file (which will cause the server to use the default php.ini file) or create a php.ini file compatible with your selected version.
Many web developers, especially beginners, have a common question “How to update PHP version in XAMPP?”. After getting a lot of queries on the topic, we decided to write a short and simple tutorial on how you can easily update PHP version in Windows XAMPP.
Table Of Content:
- How to Update PHP Version in XAMPP in 4 Simple Steps
XAMPP plays a significant role for web developers and it’s one of the most popular stacks that developers use to build and test websites locally. What makes it popular among developers is that even if something goes wrong with the code, it doesn’t affect the live web platform.
Working on the localhost is indeed a good practice to boost your web development skills and it is also common among WordPress developers. However, most users are left asking “How to change PHP version in XAMPP?” Or “How to upgrade PHP version in XAMPP?”.
In this tutorial, I will show you how easily you can update your PHP version in XAMPP through 4 simple steps. However, before embarking on the process you need to know why it is important to upgrade PHP version on XAMPP and when is the right time to change the PHP version.
Reasons to Upgrade PHP Version in XAMPP
The PHP version requirements often vary with specifications of the project you are working on. Sometimes it’s the users who demand a newer PHP version which can compel you to update it. In most cases, whenever a new PHP version is rolled out, users and developers waste no time in updating their current versions to avoid security threats.
As a member of various developers’ community, I often see many developers still using the older version of XAMPP(i.e. XAMPP 3.2.1 or older) that runs on PHP 5. What they are mostly concerned with is updating the PHP version in their current XAMPP without reinstalling it all together.
PHP 7 offers an advanced set of functionalities as compared to PHP 5, which are all reasons why you should update your PHP version as soon as it is launched. To check the PHP version, type http://localhost/phpinfo.php in your browser and a new screen will appear with the PHP version information.
Let’s look at why PHP 7 has the upper hand over PHP 5.
- For starters, PHP 7 is faster than any other version available, including PHP 5. Suppose, you have written a PHP code in PHP 5, if you run the same code on PHP 7, you will see a significant upgrade in performance.
- PHP 7 provides ease in error handling as compared to other older versions of PHP. If you are using PHP 5 then you would know how hard it is to handle fatal errors.
- PHP 7 supports anonymous class, a feature that is not available in any of the older PHP versions. Anonymous class is used to speed up the execution time which is common in other OOP languages like JAVA, C#, etc.
- PHP 7 supports 64 bit (large) files which you can run on 64 bit OS architecture. This feature is also not available on PHP 5.
- PHP 7 also includes null coalescing operators, accurate type declarations and many advanced features.
Now that we have understood how important it is to update your PHP version in XAMPP, let’s move forward and see how you can update your PHP version in 4 simple steps.
How to Update PHP Version in Windows XAMPP in 4 Simple Steps
The beauty of the XAMPP lies in the fact that it’s a development server, not a production server. This means that you can play with its configuration and make simple changes like changing its PHP version without affecting your live application.
Note: I would recommend that before you upgrade PHP version in XAMPP, make a backup for your site files or project files. ALWAYS MAKE A BACKUP FOR DATA.
Updating PHP version in XAMPP is simple. All you need to do is follow these 4 simple steps.
Step 1: Download the latest version of PHP (i.e. PHP 7.x)
First, you need to click here to download the latest binary version of PHP. Make sure you download the Thread Safe Zip file depending upon your Windows version( x86 for 32-bit and x64 for 64-bit ), as you can see in the image below.
In the above image, you can see that I have downloaded the VC14x64 Thread Safe because my windows version is 64-bit.
Step 2: Extract the Zip File and Create PHP Folder
Next, create a new folder in your Windows desktop and name it PHP. Then, extract the Zip file into that new folder(i.e. PHP).
Step 3: Rename the Old PHP Folder
Localhost Php Version Change
Next, go to XAMPP folder and select the php folder and rename it with something like php_5 and then paste the extracted-new-php folder on XAMPP directory. You can see in the below image, how I did this.
Step 4: Configuring Apache Server
Next in the process is to configure the Apache server and for this, you need to open your XAMPP control panel then click on Apache Config > Apache (httpd-xampp.conf).
Then, an httpd-xampp.config file will open on your screen. Next, in the PHP-Module setup, paste the new lines of code and remove the previous lines of code like as shown in the below image.
Previous lines of code:
New lines of code:
Then, save the file and restart the XAMPP server. Tada! It’s done.
Updating your PHP version is an absolute must if you want your WordPress site to run smoothly. The article covered how you can update your PHP version manually but there are WordPress maintenance services that take care of such tasks for you so that you can focus on more important things like your business.
I hope this tutorial helped you to learn “How to update PHP version in XAMPP”. If you need any support or if you face any problem while updating XAMPP PHP version don’t hesitate to ping me in the comments section or email me at [email protected], I would love to help you out!