How to find php version and php.ini file location path?

We can view the php settings by creating a php file in our web root with the following code:


<?php
phpinfo();
?>

Let the name of the file be phpinfo.php

The file location will be:

/var/www/phpinfo.php (For Linux)
C://xampp/htdocs/phpinfo.php (For Windows with Xampp)
C://wamp/www/phpinfo.php (For Windows with Wamp)

Open http://localhost/phpinfo.php in your browser in your local computer. If you are working online then open http://yoursite.com/phpinfo.php

You will see the following on your browser:

PHP INFO

You can clearly see that the PHP Version I am using is 5.2.5. Your version may be different from mine.

From this page, you will be able to review about all the php directives whether they are in enabled or disabled state.

You can enable, disable, or edit directives from php.ini file. See Loaded Configuration File in the above image. It shows the path of php.ini file is C:\wamp\bin\apache\apache2.2.6\bin\php.ini. You have to edit this file (php.ini) in order to configure your php settings.

Hope this helps. Thanks.