Localhost Php Version

Posted on by admin

We highly recommend PHP 7.3, 7.4 or the latest version 8.0 as it’s much faster, resource-friendly, and more secure than its predecessors. In fact, it’s shown to be 3x as fast in some configurations, as seen in our PHP benchmark reports. As you may have heard, PHP has moved to a predictable release schedule. 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.

Being a PHP developer you want to configure PHP 7 on your localhost for various reasons. You might want to explore the new features of PHP 7 or you might be upgrading your existing website to PHP 7 and want to test in your local machine first or you might be creating a brand new project on PHP 7. This blog will help you to configure PHP 7 for WAMP server in localhost.

(Note: You first check with your hosting server about PHP 7 is available or not. If yes, what version of PHP 7 is available.)

Very first thing to know is PHP 7 requires minimum Apache 2.4.x and also it needs WAMP Server 2.5. If you already have WAMP 2.5, ou do not have to uninstall anything. You can configure PHP 7 with WAMP 2.5. How to check your WAMP server version? Right click on the WAMP icon on your windows taskbar and click About... It will show your current WAMP version.

Download the required PHP version (thread safe version) depending on your 32 or 64 bit Windows from here http://windows.php.net/qa. As of now PHP 7.1.7 is available so I have downloaded PHP 7.1(7.1.7 RC1).

Now you need to download and install Microsoft Visual C++ Redistributable for Visual Studio 2015 (Click here). This is needed for WAMP to work properly. If you are using 32 bit OS, then download 32 bit package only. If you have 64 bit OS, then I recommend to install both 32-bit as well as 64-bit packages.

Once all this done, then we are ready to install/configure PHP 7 in local machine.

Let’s start installing PHP 7:

Step 1: Locate to your WAMP directory, (usually C:/wamp). Goto C:/wamp/bin/php and create a new folder “php7.1.7″ and extract the content of PHP 7.1.7 RC1 Thread Safe version here.

Step 2: Now, navigate to your old php folder. (mine is php5.5.12), and copy wampserver.conf from old and paste it to your “php7.1.7″ folder

Step 3: Now, go to C:/wamp/bin/php/php7.1.7 folder and locate file php.ini-development. Copy it and rename to php.ini in the same directory.

Open php.in file and update the following values:

  1. extension_dir = C:/wamp/bin/php/php7.1.7/ext
  2. upload_tmp_dir = C:/wamp/tmp
  3. error_log = C:/wamp/tmp

Now, scroll down to extension list replace them with the below text:

Save and close the file.

Step 4: Now, make a duplicate of php.ini file and save it as phpForApache.ini. This file is needed by Apache web server.

Step 5: Now open wampserver.conf copied in C:/wamp/bin/php/php7.1.7/ directory in Step 2 above. It should look like below:

Step 6: Start WAMP server and goto PHP >> PHP Version and there you must find version 7.1.7 and select it.

Step 7: Create a test php file in www directory of WAMP installation path. Put the below code:

You will find that the version of php is 7.1.1 and all other details of extensions.

Final suggestion: It is better to include the new path in your system path directory otherwise you may face some issues with you CURL extension. Go to Windows environment variable window and edit system variable 'Path' to add a new string 'C:wampbinphpphp7.1.7;'. This step will resolve the CURL error 'Unable to load dynamic library 'php_curl.dll' - The specified module could not be found in Unknown on line 0'

Localhost

Wish you happy coding with PHP 7. Watch the YouTube video for quick reference:

Overview

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:

  1. Log in to your Bluehost control panel.
  2. Under the Hosting tab, click cPanel in the submenu.
  3. Scroll down and look for the programming section, then click the PHP Config.
  4. Select the version of PHP you're interested in using.
  5. Click Save Change.

Note: This option only works with Legacy Account. Please see below for Rock Instructions.

Localhost php my

How to Change Versions Using MultiPHP Manager (Bluerock)

You can change your PHP version in Bluerock accounts by following these steps.
  1. Log in to your Bluehost control panel.
  2. Click on the Advanced tab from the side navigation menu to the left.
  3. In the SOFTWARE section, click MultiPHP Manager.
  4. Check the box next to the website(s) this PHP version will apply to.
  5. Choose the PHP Version, then click Apply.

Please note: If a domain is set to Inherit, it will automatically take on whatever PHP setting is assigned to the main domain.

Generate php.ini

To generate a new php.ini file:

  1. Log in to your Bluehost control panel.
  2. Under the Software section, clickMultiPHP INI Editor.
  3. Select the path by clicking on the drop-down menu under Selecting a location.
  4. Choose the domain name.
  5. 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.

Localhost Change Php Version

Things to Keep in Mind

Php Server Localhost

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.