How to Find PHP.Ini

How can I find the php.ini file used by the command line?

Just run php --ini and look for Loaded Configuration File in the output for the location of php.ini used by your CLI.

How can I know which 'php.ini' file is used?

You can use php_ini_loaded_file().

Taken from php.net:

$inipath = php_ini_loaded_file();
if ($inipath) {
echo 'Loaded php.ini: ' . $inipath;
} else {
echo 'A php.ini file is not loaded';
}

You may also want to check php_ini_scanned_files().

Also, you should note that if you run a PHP script from CLI, it's possible that a different php.ini file will be used than if a server (e.g., nginx or Apache) runs it.

Other options:

  • php -i|grep 'php.ini'
  • create info.php that contains <?php phpinfo(); in the webroot, and run it in your browser

where php.ini of is located in laravel applications?

You can use phpinfo() function to check where the php.ini file is located at:

<?php

phpinfo();

Or simply run php artisan tinker in the terminal where the laravel project is and then run phpinfo() in same terminal.

Then, look for Configuration File (php.ini) Path in the output of phpinfo().

Where is php.ini?

Run this code (and I am assuming your php is running, you are not able to just locate the php.ini file)

<?php

phpinfo();

?>

And check the location of the config file:

Location

Cannot locate my php ini file on live server?

enter in your server comand line: php -i to see all of your php's config and also in very first lines of this command output, location of your php.ini if you can't find file like php.ini in your output which may not happen make one with touch command and put your configuration in that file and reload server, depend on what you use (like fpm or ...).

edit php configuration (php.ini) in wamp

maybe your system $PATH contains php 7.4 folder
but maybe wamp is using another version

to get the right php.ini:

  1. click once on wamp icon in the windows taskbar
  2. hover php to display
  3. php details click on php.ini on the little menu

the following image describe the process wamp php.ini file

Sample Image

how to access php.ini and set file_upload directive to on

Php.ini is system file located at remote web server and it contains global configuration for PHP. Only privileged users can edit php.ini.

You can change local configuration for your script using function ini_set, for example:

ini_set('max_exection_time', 60);

According to phpinfo() you sent, you already have file_uploads set to On. So you don't need to edit anything. Just open link you sent, press CTRL+F and search for file_uploads.


By the way, WinSCP is only application used to transfer files to remote web server using FTP/SFTP or similar protocols. Actually your web server is running on RHEL Apache 2.4.6. Just see section SERVER_SOFTWARE in your phpinfo.



Related Topics



Leave a reply



Submit