How to install or update PHP

In this article

Important:
Updating your PHP will require you to temporarily stop IIS (Internet Information Services) on your server.

This means that XUNO (and any other websites hosted on the same server) will be unavailable for a period of time while you complete the update. Please make sure that you backup your PHP folder before you begin by following the steps below.

If you are not upgrading PHP from a previous version you can skip parts 1 and 2.

Part 1: Finding what version of PHP you have installed

  1. First make sure you are fully up to date with your Windows updates. After any updates are installed you should restart the server.
  2. Ensure you are up-to-date with XUNO's minimum server and browser requirements, particularly using a 64bit operating system. Minimum requirements may be accessed from here.
  3. On your XUNO server, open a new command line window.
  4. Type 'php -v' and press Enter.
  5. You will see text which will look similar to this:

    PHP 5.6.7 (cli) (built: Mar 19 2015 15:10:37)
    Copyright (c) 1997-2015 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    	
  6. If your PHP version is not 7.2 then you will need to continue with the instructions below to upgrade your version of PHP.

  

Part 2: Backing up your PHP installation

  1. On your XUNO server, open IIS and click on the Stop button to disable your IIS.
  2. Open your windows explorer and navigate to the location of your PHP installation. By default this is in C:\Program Files (x86)\PHP.
  3. Copy your entire PHP folder to create a backup of it in the same location. For example, if your PHP folder is "C:\Program Files (x86)\PHP", then copy the entire PHP folder and copy to "C:\Program Files (x86)\PHP Backup".

  

Part 3: Downloading & installing the latest PHP

  1. First make sure you are fully up to date with your Windows updates. After any updates are installed you should restart the server.
  2. Ensure you are up-to-date with XUNO's minimum server and browser requirements, particularly using a 64bit operating system. Minimum requirements may be accessed from here.
  3. On your XUNO server, open IIS and click Get New Web Platform Components located in the Actions panel on the right side of the window. This will run the Web Platform Installer. You may first need to download the installer.
  4. In the search bar, located in the top-right corner of the installer, type PHP and click enter.
  5. Find the PHP 7.2 option from the list of search results and click Add. This item will read something like PHP 7.2.7 (x64).

    Note: Do not select the IIS Express version of PHP

  6. Click Install
  7. In the next window, click I Accept to accept the prerequisites.

    Note: The installation of some prerequisites may fail. Some of these prerequisites are required in order to run PHP and other prerequisites are supporting features. The following steps will tell you if PHP has been installed correctly

  8. Close the installer.
  9. Navigate to the PHP 7.2 installation directory. This is usually found in C:\Program Files\PHP\v7.2
  10. Open up the php.ini file in NotePad.
  11. Find the Extensions section and remove the semi-colon at the beginning of each of these lines:
     
    extension=php_curl.dll
    extension=php_gd2.dll
    extension=php_ldap.dll
    extension=php_mysqli.dll
    extension=php_xmlrpc.dll
    extension=php_mbstring.dll
    extension=php_pdo_mysql.dll
    extension=php_openssl.dll
    	

    Additional Extensions - If you are currently using Human Edge Attendance with XUNO, you will need to install the Microsoft Driver for PHP for SQL Server. You can download the PHP 7.2 driver from here. If you are running an earlier version of PHP, please go here and choose the appropriate installer.
    Remember to also install the Microsoft ODBC driver that correlates to the package you are downloading. You will be able to find out what ODBC driver is required by scrolling down to System Requirements before clicking the download button. 

  12. Scroll to the bottom of the file. Then copy and paste the following lines at the end of the php.ini file. Replace <insert SMTP server address> and <insert school email address> with your SMTP and email details (for example: smtp.edumail.vic.gov.au and sthmelbcol.vic.edu.au).

    [XUNO]
    display_errors = Off
    error_reporting = E_CORE_ERROR & E_ERROR & E_PARSE
    post_max_size = 80M
    file_uploads = On
    upload_max_filesize = 80M
    upload_tmp_dir = "C:\Windows\Temp"
    date.timezone = Australia/Melbourne
    SMTP = <insert SMTP server address>
    sendmail_from = <insert school email address>
    extension_dir = "ext"
    log_errors = On
    fastcgi.impersonate = 1
    error_log = C:\Windows\Temp\php_errors.log
    cgi.force_redirect = 0
    cgi.fix_pathinfo = 1
    fastcgi.logging = 0
    max_execution_time = 300
    memory_limit = 256M
    max_input_vars = 10000
    mysqli.allow_local_infile = On
    	
  13. Save the changes to your php.ini file.

  

Part 4: Validating your PHP installation

  1. On your XUNO server, open a new command line window.
  2. Type 'php -v' and press Enter.
  3. A successful PHP installation will return text which will look similar to this:

    PHP 7.2.20 (cli) (built: Mar 19 2017 15:10:37)  
    Copyright (c) 1997-2015 The PHP Group  
    Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    	
  4. Open IIS and click on the Start button to start IIS.

Part 5: A little help with validating your PHP installation

If you are getting the following error when typing 'php -v' into command prompt:

'php' is not recognized as an internal or external command,
operable program or batch file.

Then you will need to run through a few steps:

  1. Press Windows Key + Pause
  2. On the left pane, click Advanced system settings
  3. Click Environment Variables
  4. Down the bottom in System variables, choose to edit Path 
  5. Make sure the full PHP path appears, if it does not you will need to add it by clicking New, and then Browse
  6. If it does not appear, you may need to update and/or restart the server 

Still need help? Contact Us Contact Us