PHP is the most popular open-source general-purpose scripting language in this World. The main use of PHP is creating forums, picture galleries, check details from a form, etc.
The main advantage of PHP is that it can easily be run on various platforms. See the instructions for installing PHP, changing PHP settings and enabling PHP extension on Windows IIS below.
Install PHP on Windows Cloud Servers (Using Web Platform Installer)
Install the extension in IIS, please download this by visiting https://www.microsoft.com/web/downloads/platform.aspx.
Then click Install this extension
.
Proceed with the Installation of extension after accepting the terms & conditions.
Open IIS and verify the Web Platform installation Extension showing under Management
section.
Click Web Platform Installer
icon under the Management section and search for the PHP version you need to install in the search box.
Click Add
button against the required PHP version.
Then click Install
button to install the PHP (E.g. PHP 7.2.19).
Click Accept
for the installation.
Once installation is completed, click Exit
button to exit from Web Platform Installer.
Verify PHP handlers which showing under Handler Mapping
section.
Verify PHP installation by accessing the PHP info page by placing a PHP file under any website in the server or under the default website document root.
For this, create a new text file named info.txt
and type in the below content.
Once the file has been saved, rename the file extension to PHP, thereby, changing the file name to info.php
.
This info.php
file can now be browsed using any browser using the website name under which the file is created or using the server IP address or localhost
if the file is created in the default website document directory and the existing PHP version and its settings can be viewed.
http://websitename/info.php (replace `websitename` with the name of the website)
(or)
http://123.123.123.123/info.php (replace `123.123.123.123` with the server IP address)
(or)
http://localhost/info.php
Change PHP Settings on Windows Cloud Servers
Open the directory under which the phpinfo file is to be created.
Create the file with the phpinfo function using any editor of your choice.
The file, info.php
can now be browsed using any browser and the existing PHP version and its settings can be viewed. A general example of the phpinfo page is as shown below:
The file displayed to the right side of Loaded Configuration File
is the PHP configuration file in which the PHP settings need to be changed.
Open the PHP configuration file using any editor of your choice and make necessary changes to the PHP settings as per your requirement.
For example, if you require to increase the maximum size of files that you need to upload through your PHP application, the variables that need to be adjusted are post_max_size
and upload_max_filesize
. The existing values of both these variables can be found in the php.ini file.
Modify these values according to your requirement in the PHP configuration file, save the file.
Some other common PHP values that often require adjustment are the PHP memory limit and PHP execution time, denoted by the variable’s memory_limit
and max_execution_time
respectively.
Enable PHP extension on Windows Cloud Servers
The core functionality of PHP is PHP modules/ extensions. It helps to enable specific functions to be used in the PHP code.
The below steps can be followed for enabling required PHP extensions in the server.
Check for the path of the PHP configuration file in your server. This value can be found out on the PHP info page.
Here Loaded Configuration File
of PHP is C:\Program Files\PHP\v7.2\php.ini
.
Open the Loaded Configuration File
of PHP in any editor of your choice and make necessary changes to the file to enable the extension.
For example, to enable PHP pdo_mysql extension, find the relevant part in the PHP configuration file for this extension, as below:
Remove the semicolon( ; )
to uncomment the extension and save the file.
Restart IIS service.
Open service manager from Control Panel
>> System and Security
> Administrative Tools
.
Right-click the service World Wide Web Publishing Service >>
then click Restart
.
To verify that the PHP extension has been enabled, load the PHP info file
and search for pdo_mysql
.