Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the php.ini file on a Linux/CentOS PC? [duplicate]

Tags:

linux

php

centos

I can't find PHP.ini location on my server. I've checked all Stack Overflow answers but I can't find my php.ini location.

I have Linux, Cent OS, zPanel. Last version of PHP.

My computer: Linux Mint 15 KDE.

like image 436
MM PP Avatar asked Jul 25 '13 06:07

MM PP


People also ask

Where is my PHP ini file CentOS?

ini file comes from in CentOS. These are all of the default configuration files that are installed by the php-common package, we can see here that by default the php. ini file is found at /etc/php. ini.

Where is the PHP ini in Linux?

ini is usually located in /etc/php/8.1/fpm/php.

Where is the location of PHP ini?

user. ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits. This file is located on your server in the /public_html folder.

How do I know which PHP ini file is being used?

Check php. ini in CLI (Command Line Interface): To know about php. ini, simply run on CLI. It look for Loaded Configuration File in output for the location of php.


1 Answers

In your terminal/console (only Linux, in windows you need Putty)

ssh user@ip php -i | grep "Loaded Configuration File" 

And it will show you something like this Loaded Configuration File => /etc/php.ini.

ALTERNATIVE METHOD

You can make a php file on your website, which run: <?php phpinfo(); ?>, and you can see the php.ini location on the line with: "Loaded Configuration File".

Update This command gives the path right away

cli_php_ini=php -i | grep /.+/php.ini -oE  #ref. https://stackoverflow.com/a/15763333/248616     php_ini="${cli_php_ini/cli/apache2}"   #replace cli by apache2 ref. https://stackoverflow.com/a/13210909/248616 
like image 92
NETCreator Hosting - WebDesign Avatar answered Sep 22 '22 07:09

NETCreator Hosting - WebDesign