Applies to: PHP 8.x on cPanel hosting, VPS and dedicated servers (tested with PHP 8.3.35 on Apache)
phpinfo() shows every PHP setting that applies to your website: the PHP version, which php.ini file is loaded, upload limits, memory limit and the installed extensions. It is the quickest way to see what PHP is really using, because the web server can use different settings from the command line.
1. Create the page
- In cPanel, open File Manager and go to
public_html(or your site’s folder). - Click + File, name it
info.php, then edit it and add this single line:
<?php phpinfo();
Open https://example.com/info.php in your browser. Use Ctrl+F (or Cmd+F) to find a setting.
2. What to look for
- PHP Version at the top.
- Server API: how PHP runs, for example
Apache 2.0 HandlerorFPM/FastCGI. - Loaded Configuration File: the
php.iniin use.(none)means PHP runs on its built-in defaults. - Scan this dir for additional .ini files: extra settings files that are also read.
- upload_max_filesize, post_max_size, memory_limit, max_execution_time. With no
php.ini, our test showed PHP’s defaults: 2M, 8M and 128M. - Local Value is what applies to this folder (after
.user.inior.htaccesschanges); Master Value is the server-wide value.
3. Delete it when you are done
The page is large (about 90 KB in our test) and shows file paths, versions and environment details that help attackers. Delete info.php as soon as you have what you need; if you must keep it, protect the folder with a password (password protect a directory in cPanel).
From the command line (SSH)
php -v # version php --ini # which php.ini files are loaded php -i | grep -E "^(upload_max_filesize|post_max_size|memory_limit)"
The command line often uses a different php.ini from your website (in our test, Server API was Command Line Interface), so check the web page when a website setting doesn’t seem to work.
Check a single value
<?php echo ini_get('upload_max_filesize');
Change the settings
On cPanel hosting, use MultiPHP INI Editor for limits and MultiPHP Manager for the PHP version: increase the PHP upload limit and change the PHP version for your domain. On a VPS, edit the php.ini shown under Loaded Configuration File and restart PHP-FPM or the web server.