Learning PHP Part 8 : How to Change The PHP Configuration File (PHP.ini)


In this tutorial learn PHP this time we will learn how to change/edit a file through PHP configuration file php.ini. This sounds a bit complicated. But by knowing how to change PHP settings, will help us in mastering PHP.

Looking for PHP.ini file with phpinfo()

Just like MySQL, Entire PHP settings in a configuration file called PHP.ini. Depending on the default PHP.ini file could be in the Windows system folder, or in a folder of PHP itself.

To know the location of the PHP.ini file, run the XAMPP and Apache web server, and then from the localhost home page, find the menu of phpinfo() in the left menu.

How to-change-files-Config-PHP.ini phpinfo-locations-at-XAMPP

phpinfo() is a default PHP function is used to find out the settings of PHP itself. You can also display phpinfo by creating a PHP file, and write the following code :

In the display phpinfo() will be visible throughout the PHP configuration. However, you cannot change the configuration on this page, but had to change it directly on the file php.ini.

Top of page note the phpinfo(), you will find the value of “Loaded Configuration File“, this is the address of the location of the PHP.ini that we seek. In my example, the file is located at D:\xampp\php\php.ini, please open Windows Explorer and search for this file.

How to-change-files-Config-PHP.ini-Loaded-Configuration-File
How to-change-files-Config-PHP.ini-location of PHP.ini

Get to know the PHP Configuration File : php.ini

The PHP.ini file is a text file that we can open it with the application text always, like the default Windows Notepad, but if you have already installed the application Notepad ++, open with Notepad + +, because Notepad ++ features syntax highlighting, which distinguishes between settings and comments, so that simplify the process of editing the php.ini settings.

How to-change-files-Configuration-php. ini-Amend-PHP.ini

The php.ini file has certain rules, i.e. the whole of the line beginning with a semicolon (the semicolon) “;” is considered as a comment and will not be executed by PHP. If you notice, 80% content of php.ini is a comment, so we can easily understand what for those settings.

Most of the default php.ini requires only a single line and gave him the value of on, off or a specific value. Almost every default php.ini is preceded by an explanation of the purpose and the goal.

For example, the tutorial on how to insert PHP code into HTML, we need to modify the PHP.ini settings so that PHP can support SMGL method Style and ASP Style.

HP ASP Style tags method, so it can not be used.
To make the order for the PHP support SMGL Style, the settings must be changed is the short_open_tag. This serves to make default PHP support tags “<?” and “?>“.

Look for the word short_open_tag in php.ini, use the search facilities of Notepad ++. In php.ini there may be more than 1 Word, search for short_open_tag short_open_tag = off, and change its value being On.

As for the default ASP Style, which needs to be changed is the default asp_tags =on.

How to-change-files-Config-PHP.ini short_open_tag Setting-up-and-asp_tags

Once again, save the modified php.ini. In order for the settings we just change can be active, we should restart the Apache Web Server. Open the XAMPP Control Panel, Click the Stop button on the Action of the Apache, and then click the Start button again.

To test it, create a new php file, we just call the opentag.php, type the following code:

Save and run in the browser.

How To-Work-Sample-PHP-Web-Servers-Running PHP-Files

If you find the result in the browser there is a sign “<?” and “<%“, then default PHP yet support SGML and ASP Style as the way we go into the PHP mode. However, if the web browser display like the look above, means the default php.ini has been successfully changed.

To change the default PHP other measures used are the same as above, but for a more secure, copylah php.ini file in the backup folder to the default settings, so if you dabble in PHP settings and found there is a problem, you live cut early php.ini.

later in the Tutorial Learn PHP in webspoint we will go directly into the PHP programming. We will learn about the basic rules of writing PHP code.


  1. Hello there, I think your web site may be having browser compatibility problems.
    Whenever I look at your blog in Safari, it looks fine however when opening in IE, it’s
    got some overlapping issues. I merely wanted to provide you with a quick heads up!
    Other than that, excellent website!


Please enter your comment!
Please enter your name here