The location of the php.ini file can vary depending on the server configuration. Here are a few ways to find the location of the php.ini file.
-
Use the phpinfo() function: Create a new PHP file with the following code and run it on your server:
<?php phpinfo(); ?>
This will display a lot of information about your PHP installation, including the location of the php.ini file.
-
Use the command line: You can use the following command in the command line/terminal to locate the php.ini file:
php --ini
This will display the location of the php.ini file.
-
Check with your hosting provider: If you are on a shared hosting plan, you may not have access to the php.ini file. In this case, you can contact your hosting provider to find out the location of the file.
-
Look for default location: If you are running PHP on Windows, the php.ini file is typically located in the Windows directory, such as C:\windows or C:\winnt. On Linux, it is typically located in /etc/ or /usr/local/lib/.
Note: you may have multiple php.ini file on the server, make sure you are editing the correct one.