How to find your php.ini file
Table of Contents
What is the
PHP uses an INI file for all of it's configuration. It gets loaded when PHP starts up and is used to configure extensions and various PHP features.
How you locate your
php.ini file all depends on what sort of access you have to your server. I'll detail a couple of different methods below.
If you have access to
php through the command-line (inside of your terminal - maybe via SSH), you can find the
php.ini file quite quickly.
- Open your terminal locally or connected to your server via SSH.
- Run the
- Locate the path to the
php.inifile in the output.
% php --ini Configuration File (php.ini) Path: /opt/homebrew/etc/php/8.2 Loaded Configuration File: /opt/homebrew/etc/php/8.2/php.ini Scan for additional .ini files in: /opt/homebrew/etc/php/8.2/conf.d Additional .ini files parsed: /opt/homebrew/etc/php/8.2/conf.d/error_log.ini, /opt/homebrew/etc/php/8.2/conf.d/ext-opcache.ini, /opt/homebrew/etc/php/8.2/conf.d/php-memory-limits.ini
If you can load a PHP script in the browser, you can use the
phpinfo() function to output all of PHP's configuration values and find the path to the
Put the following snippet of code into a PHP file and load the file in your browser.
What are your thoughts on "How to find your php.ini file"?
You need to create an account to comment on this post.