PHP - How to find the php.ini configuration file

  • Last update: Apr 3, 2024
  • Views: 29
  • Author: Admin
PHP - How to find the php.ini configuration file

In the PHP programming language, the php.ini file is the main configuration file. The moment the php interpreter starts, it first looks for the php.ini configuration file and loads it. That file stores all the parameters that are responsible for the normal operation of the interpreter. The location of the php.ini file is highly dependent on the environment in which you are using PHP.

In this article, we will show you a few tricks that will show you where the php.ini configuration file is located.

 

The content of the article:

  1. php_ini_loaded_file function.
  2. ssh commands.

 

1. Function php_ini_loaded_file.

The  php_ini_loaded_file() function shows the path to the php.ini configuration file. If there is a problem loading the configuration file, the function will return FALSE.

<?php
echo php_ini_loaded_file();
?>

find php. ini


 

2. SSH commands.

You can also use SSH console commands to find out where you have your php.ini configuration file.

 

First team.

$. php --ini

find php. ini

 

Second team.

$. php -i | grep php.ini

find php. ini

 

Third team.

$. php -i | grep "Configuration File"

find php. ini


 

Thank you all, I hope my article was of some help to you.

SIMILAR ARTICLES