Development and databases
View all the configuration settings and values of the PHP version in use
It is often useful to see the PHP configuration in use, whether to check the value of specific settings, compare the configuration with another environment or check whether changes you made have taken effect.
First check the information in cPanel's PHP section or, if you need the terminal environment, run php -i. The terminal shows PHP CLI: it does not show the effective configuration of a web request. These methods do not publish paths, environment variables or module details at a URL reachable from the internet.
If you specifically need to check the configuration of the PHP that serves the website and there is no other way, temporarily create a file protected by additional authentication or restricted to your IP:
<?php phpinfo();
Open it over HTTPS, carry out the check and delete the endpoint immediately. Do not link to it, do not keep it for future tests and do not share its full output: phpinfo() can expose internal paths, versions, headers and environment variables that are useful to an attacker.
Check only the value you need
To check an option from the terminal without dumping the whole configuration:
php -r 'echo PHP_VERSION, PHP_EOL; echo ini_get("memory_limit"), PHP_EOL;'
If you need to check it over the web, use a protected test in the same folder as the application. For example:
<?php header('Content-Type: text/plain; charset=UTF-8'); echo 'PHP: ', PHP_VERSION, PHP_EOL; echo 'memory_limit: ', ini_get('memory_limit'), PHP_EOL;
This snippet does not include access protection: set it up first and delete the file when you finish. Do not use a different folder if you are checking a per-directory PHP rule.
In phpinfo(), Local Value shows the value applied in that context and Master Value the base value. It can be normal for them to differ if there is a customisation. Also check the interpreter and the configuration files loaded before comparing two results.
Do not send the full output to support if the option name, the value and the context (web or terminal) are enough. If you need to share more information, first check that it does not include credentials or request data.
You may also find useful
- Change PHP options with the selector or .htaccess Change supported PHP directives from the cPanel selector or, when the handler allows it, with php_va...
- Change a website's PHP version with checks and rollback Change a website's PHP version, or your hosting's default version, from the client area, with a comp...
- Different PHP versions per directory or domain Assign a different PHP version to a website or any folder from the client area or with AddType in .h...
- PHP binary paths for each version Use the absolute path of each PHP version's binary when running cron jobs, commands or scripts that...
Something wrong or out of date? Tell us and we will review it.