PHP security: supported versions, php.ini, Composer and six code patterns to check
A PHP application inherits its exposure from the branch it runs on, the php.ini values the web server actually loads, the Composer packages it installs and the way its own code handles output, queries, uploads, sessions, errors and serialised data.
This guide sets out what php.net, the PHP project and Composer's documentation say about each, with an evidence checklist you fill in for your own servers and a column that says how to confirm each change.
In this guide
PHP runtime, php.ini and Composer evidence checklist
Make a spreadsheet from this table for every internet-facing environment, one per environment. Rows A1 to A14 read the PHP runtime and its configuration, rows B1 to B5 read Composer, and rows C1 to C6 compare your code with six short patterns that were written for this page and not run.
How to use itHide the instructions
Change nothing while filling it in, and never write a key, password, token or cookie value into it. Where a file you read can hold a credential, such as a pool file's env lines, Composer's authentication settings, a deploy script or a log, record only whether one is present. The last column says how to confirm a change, on your own staging copy where the check needs a running site. A php.ini-production value in a row is the value in that file in the php-src PHP-8.5 branch, not PHP's built-in default. The documentation column was checked against php.net, the php-src and php/policies repositories and Composer's documentation on 15 November 2026, except Composer's command-line reference, read on 14 November 2026.
25 rows
Item
What the documentation says
A1. PHP branch and support dates
- What the documentation says
- Supported Versions page: each branch is fully supported for two years from its initial stable release, then supported for two more years for critical security issues only, with releases made as needed, then reaches end of life. On 15 November 2026 its "Security Support Until" column gave 31 Dec 2026 for 8.2, 31 Dec 2027 for 8.3, 31 Dec 2028 for 8.4 and 31 Dec 2029 for 8.5. Unsupported Branches page: 8.1 reached end of life on 31 Dec 2025.
- Where to look, or the pattern (not run)
- The version the web server's PHP reports, from your host's PHP settings or the PHP-FPM service on the server, and php -v on the command line, whose example output names the server API, such as cli. Then the branch's row on the Supported Versions page.
- What to write down
- The full version for the web server and for the command line separately, the branch, its "Security Support Until" date and the date you read the page.
- How to verify the change
- After an upgrade on staging, read the web server's version again from the same place, and check the new branch's security support date on the Supported Versions page.
A2. Which php.ini files each server API loads
- What the documentation says
- Configuration file page: php.ini is read when PHP starts, once when the web server starts for server modules and on every invocation for CGI and the command line; PHP looks for php-SAPI.ini before php.ini and may scan a further directory for .ini files. Command line options page: php --ini, available only in CLI, shows configuration file names and scanned directories, and --ini=diff shows the differences from the default configuration, from PHP 8.5.0.
- Where to look, or the pattern (not run)
- php --ini on the server for the command line. For web requests, the loaded file and scan directory named in your host's PHP settings or in the PHP-FPM service's configuration.
- What to write down
- Each loaded file and scan directory, for each server API and environment, and who can edit each one.
- How to verify the change
- After editing a file, confirm it is the one listed as loaded. For a file the command line loads, on PHP 8.5 or later, run php --ini=diff, which lists directives whose loaded value differs from the default configuration; a directive changed back to its default will not appear there, so read it from the file instead. Record when the web server or PHP service last restarted after the edit.
A3. Per-directory, pool and runtime overrides
- What the documentation says
- Modes page: INI_SYSTEM entries go in php.ini or httpd.conf; INI_PERDIR adds .htaccess and .user.ini; INI_USER covers scripts using ini_set(), the Windows registry and .user.ini; INI_ALL can be set anywhere. .user.ini page: read only by the CGI/FastCGI server API, from the requested file's folder up to the document root, and re-read every 300 seconds by default. PHP-FPM page: php_value and php_flag overwrite earlier values, except that disable_functions is appended to the php.ini value, and php_admin_value and php_admin_flag cannot be overridden with ini_set().
- Where to look, or the pattern (not run)
- The document root and its folders for .user.ini and .htaccess files, each PHP-FPM pool file for php_value, php_flag, php_admin_value and php_admin_flag lines, the web server configuration for PHP settings, and the code for ini_set( calls.
- What to write down
- Each override: the file or line, the directive, the value, and whether code can change it at runtime. If a pool file also holds env lines with credentials, record only that they are present.
- How to verify the change
- After moving a setting into php.ini or an admin line in the pool file, search again and confirm nothing else sets it to another value. With the default user_ini.cache_ttl, allow up to 300 seconds for a .user.ini change to be read again.
A4. display_errors and display_startup_errors
- What the documentation says
- Error handling configuration page: both have a default of "1", and display_startup_errors was "0" before PHP 8.0.0; php.ini-production sets display_errors Off. display_errors should never be used on production systems (e.g. systems connected to the internet), and keeping display_startup_errors off except for debugging is strongly recommended. Set at runtime with ini_set(), display_errors has no effect if the script has fatal errors.
- Where to look, or the pattern (not run)
- The loaded php.ini and every override from A3, in each environment the internet can reach.
- What to write down
- The value of each directive, where it is set and the date.
- How to verify the change
- Read both values again from the loaded file and the overrides. Then, signed in to your staging copy as a test account, open a handful of pages one at a time and confirm they show no PHP warning text or file paths, and that any PHP errors they raise go to the log from A5 instead. Record only whether entries appeared, not their text.
A5. log_errors and error_log
- What the documentation says
- Error handling configuration page: log_errors defaults to "0", and error logging in place of error displaying is strongly advised on production web sites; without error_log, errors go to the server API's error logger, such as Apache's error log. php.ini-production sets log_errors On. Error Reporting page: if display_errors is turned off, also define error_log and turn log_errors on.
- Where to look, or the pattern (not run)
- The loaded php.ini and the pool file, the path error_log names, and the web server's document root.
- What to write down
- On or off, the log path, whether that path sits under the document root, and who can read the log. Not the log's contents.
- How to verify the change
- Confirm that errors raised by the page views in A4, if any, reach this log, recording only whether they did. If the log sits under the document root, send one HEAD request to its URL on your staging copy with a command that prints only the status code, such as curl -s -o /dev/null -w '%{http_code}' -I followed by the URL, and record only the status code.
A6. zend.exception_ignore_args
- What the documentation says
- Core directives page: default "0", INI_ALL, available as of PHP 7.4.0. php.ini-production sets it On and recommends it in production to prohibit the output of sensitive information in stack traces.
- Where to look, or the pattern (not run)
- The loaded php.ini and the overrides from A3.
- What to write down
- The value and where it is set.
- How to verify the change
- Read the value again after the change, and check that the next stack trace in the staging error log lists no argument values. Record yes or no, not the trace.
A7. expose_php
- What the documentation says
- Core directives page: default "1", set in php.ini only; it exposes that PHP is installed, including the version in an HTTP header such as X-Powered-By. php.ini-production leaves it On, with a comment that it is no security threat in any way but makes it possible to determine whether you use PHP. Hiding PHP page: in general, security by obscurity is one of the weakest forms of security, and turning expose_php off reduces the information available to an attacker.
- Where to look, or the pattern (not run)
- The loaded php.ini, then the response headers of your staging home page.
- What to write down
- The value, and whether an X-Powered-By header appears.
- How to verify the change
- Send one HEAD request to your staging home page and print only that header, for example with curl -sI followed by the URL, piped to grep -i x-powered-by. Record whether it is present. If it is still there with expose_php off, find the layer that adds it.
A8. allow_url_fopen and allow_url_include
- What the documentation says
- Filesystem configuration page: allow_url_fopen defaults to "1" and enables URL-aware fopen wrappers, whose defaults reach remote files over ftp or http; allow_url_include defaults to "0", lets include and require use those wrappers, needs allow_url_fopen on, and is deprecated as of PHP 7.4.0. Both are INI_SYSTEM. php.ini-production sets allow_url_fopen On and allow_url_include Off.
- Where to look, or the pattern (not run)
- The loaded php.ini and the overrides from A3, and a code search for include and require statements whose path is a variable.
- What to write down
- Both values, each include or require with a variable path and where that value comes from, and the features that open remote files if allow_url_fopen stays on.
- How to verify the change
- Read both values again, repeat the code search, and record how many variable-path includes there were before and after.
A9. open_basedir and disable_functions
- What the documentation says
- Core directives page: open_basedir defaults to allowing all files to be opened, does not restrict access to Unix domain sockets, and is "just an extra safety net, that is in no way comprehensive". disable_functions must be set in php.ini, can be circumvented and should not be considered a sufficient security measure for shared hosting environments. SECURITY.md lists bypasses of either among issues not considered security issues. PHP-FPM page: pools are not a security mechanism.
- Where to look, or the pattern (not run)
- The loaded php.ini and the overrides from A3, and your host's description of how sites on the server are kept apart.
- What to write down
- Both values, and what actually separates this site from others on the same server, such as separate servers, containers or system users, with the document that says so.
- How to verify the change
- Read the values again after a change, and record the separation relied on and who confirmed it.
A10. Upload directives
- What the documentation says
- Core directives page: file_uploads "1" (INI_SYSTEM), upload_max_filesize "2M", post_max_size "8M", which must be larger than upload_max_filesize, max_file_uploads 20, and upload_tmp_dir unset, so the system's default temporary directory is used. When post data exceeds post_max_size, $_POST and $_FILES are empty. POST uploads page: the server-side maximum size cannot be fooled, unlike the MAX_FILE_SIZE form field.
- Where to look, or the pattern (not run)
- The loaded php.ini and the overrides from A3.
- What to write down
- Each value, whether the application accepts uploads at all, and the temporary folder and who can read it.
- How to verify the change
- Read the values again. Where the application takes uploads, sign in to staging as a test account and upload one file you made that is just over the new limit; confirm it is refused and nothing is stored, and delete anything that is.
A11. Session cookie and session ID settings
- What the documentation says
- Session configuration page: session.use_strict_mode, session.cookie_secure and session.cookie_httponly default to "0"; session.cookie_samesite defaults to an empty value, which sets no SameSite attribute; session.use_only_cookies defaults to "1" and session.use_trans_sid to "0". php.ini-production leaves strict mode at 0, session.cookie_secure commented out, and session.cookie_httponly and session.cookie_samesite empty. Securing Session INI Settings: strict mode is mandatory for secure sessions; session.cookie_httponly refuses access from JavaScript; a site only reachable over HTTPS should enable session.cookie_secure; session.cookie_samesite "Lax" or "Strict"; session.use_trans_sid off.
- Where to look, or the pattern (not run)
- The loaded php.ini, the pool file and any .user.ini, plus a code search for session_set_cookie_params( and ini_set('session. calls.
- What to write down
- Each value and where it is set, and the session cookie's name.
- How to verify the change
- Send one GET request to a staging page that starts a session, with a command that removes the cookie's value before anything is printed, for example curl -s -o /dev/null -D - followed by the URL, piped to grep -i '^set-cookie' and then to sed -E 's/=[^;]*/=removed/'. Record which attributes are present (Secure, HttpOnly, and SameSite with its setting). If staging sets the session cookie only after sign-in, record that and rely on the configured values instead.
A12. Session save path and save handler
- What the documentation says
- Session configuration page: with the files handler, session.save_path is where session files are created; its table gives a default of "", while its warning says a world-readable directory such as /tmp (the default) may let other users on the server hijack sessions by getting the list of its files. If a custom save handler does not implement validateId() or supply the validate_sid callback, strict mode is effectively disabled. Session Management Basics: user defined save handlers should implement session ID validation.
- Where to look, or the pattern (not run)
- session.save_handler and session.save_path in the loaded php.ini and overrides, the permissions of that directory itself, and any session_set_save_handler( call in the code.
- What to write down
- The handler, the path, the directory's owner and permissions, and whether a custom handler implements validateId(). Do not open any session file.
- How to verify the change
- After a change, list the directory's own permissions again (for example with ls -ld on the directory) and confirm the handler code includes validateId().
A13. PHP-FPM listen address and allowed extensions
- What the documentation says
- PHP-FPM page: an exposed FastCGI endpoint allows arbitrary code execution; a Unix socket is preferred when the web server runs on the same host, with access then controlled on Linux by listen.owner, listen.group and listen.mode, although many BSD-derived systems accept connections regardless of those permissions; with TCP, listen.allowed_clients is unset by default and then accepts any address; in containers, the FPM port should not be published on the host; php-fpm should not be bound to a worldwide accessible address. security.limit_extensions defaults to .php .phar, and the page says FPM should be limited to .php extensions.
- Where to look, or the pattern (not run)
- Each pool file's listen, listen.allowed_clients, listen.owner, listen.group, listen.mode and security.limit_extensions lines, the container port mappings and the server's firewall rules.
- What to write down
- For each pool: the listen address or socket, the allowed clients, the socket's owner and mode, and the extensions list.
- How to verify the change
- Read the pool file again after the change, and confirm from the container and firewall configuration that the FPM port is not published beyond the host.
A14. register_argc_argv
- What the documentation says
- Core directives page: default "1", INI_PERDIR, deprecated as of PHP 8.5.0. Its note says deriving argc and argv from the query string for non-CLI server APIs has been deprecated, and to configure register_argc_argv=0 and use $_GET or $_SERVER['QUERY_STRING'] after verifying that the usage is safe. The Laravel guide in this library covers a framework advisory that depends on this setting.
- Where to look, or the pattern (not run)
- The loaded php.ini for the web server and the overrides from A3, and a code search for argv in code that serves web requests.
- What to write down
- The value, and each place web-facing code reads argv.
- How to verify the change
- Read the value again after the change, and repeat the code search.
B1. composer.lock and the deploy command
- What the documentation says
- Composer basic usage: update writes exact versions to composer.lock, which should be committed so the CI server, production machines and developers run the same dependencies; install with a lock file present uses its exact versions, and warns when composer.lock has not been updated after composer.json changes that might affect resolution. Command-line reference: install --no-dev skips require-dev packages, and autoloader generation skips the autoload-dev rules.
- Where to look, or the pattern (not run)
- The repository, to see whether composer.lock is tracked, and the deploy script or pipeline step that runs Composer.
- What to write down
- Whether composer.lock is committed, the exact Composer command and flags used on deploy, and whether production ever runs update. If the deploy script holds a credential, record only that it is present.
- How to verify the change
- Deploy to staging and read the deploy log for the install command and its flags. Confirm that a package listed only in require-dev is absent from the staging vendor folder.
B2. composer audit
- What the documentation says
- Command-line reference: audit checks installed packages against dependency policies such as security advisories, looked up through the Packagist.org API by default or through other repositories composer.json names, and also detects abandoned packages and packages flagged as malware; it exits with 0 for no issues, and with 1 when it found packages matching dependency policies or failed because required packages were missing; --locked audits from composer.lock; --no-dev skips require-dev packages; install --audit runs an audit after installation.
- Where to look, or the pattern (not run)
- composer audit --locked in a checkout of the deployed commit.
- What to write down
- The date, the exit code, and each advisory ID with its package and installed version.
- How to verify the change
- After updating, run it again on the new lock file and record the exit code, or each advisory you chose to ignore with its reason. The dependency security guide covers that decision.
B3. Dependency policy, plugins and download settings
- What the documentation says
- Composer configuration chapter: policy.advisories.block defaults to true, blocking versions with active advisories during update, require and remove unless ignored, and dev-* branch versions are never blocked; allow-plugins defaults to {}, which does not allow any plugins to be loaded, and from Composer 2.2.0 lets you restrict which plugins can execute code during a Composer run; secure-http defaults to true, so only HTTPS URLs are allowed to be downloaded; disable-tls defaults to false, and enabling it is a security risk that also disables secure-http. Command-line reference: the environment variables it lists override certain settings and always take precedence over composer.json; COMPOSER_POLICY_ADVISORIES_BLOCK=0 disables advisory blocking and COMPOSER_NO_BLOCKING=1 disables all policy based blocking.
- Where to look, or the pattern (not run)
- The config section of composer.json, the global Composer configuration on build machines, and the names of COMPOSER_ environment variables set in CI jobs.
- What to write down
- Each setting and where it is set, each ignored advisory or package with its reason, each allowed plugin, and any repository URL that starts with http://. For authentication settings and tokens, including COMPOSER_AUTH, record only whether each is present, never its value.
- How to verify the change
- Read the configuration again after the change, both in the file and in the list of COMPOSER_ variable names the CI job sets.
B4. Platform requirements
- What the documentation says
- Composer basic usage: the php platform package represents the PHP version, and ext- packages require PHP extensions. Configuration chapter: the platform setting fakes platform packages, so dependencies are not checked correctly any more, and running check-platform-reqs as part of deployment is recommended. Command-line reference: check-platform-reqs checks the real PHP and extension versions against installed packages and ignores the platform setting.
- Where to look, or the pattern (not run)
- The require section of composer.json (php and ext- entries) and config.platform.
- What to write down
- The declared PHP range, any platform override, and the check-platform-reqs result on staging.
- How to verify the change
- Run composer check-platform-reqs on staging after the change, and record a pass or each requirement that failed.
B5. Composer files and the document root
- What the documentation says
- Composer basic usage: composer.json typically goes in the top-most directory of the project, vendor is the conventional location for all third-party code, and composer.lock holds the exact version of every package. This page's advice, not Composer's: keep vendor, composer.json and composer.lock outside the web server's document root.
- Where to look, or the pattern (not run)
- The document root in the web server or hosting configuration, compared with where the project folder sits.
- What to write down
- The document root path, and whether vendor, composer.json and composer.lock sit beneath it.
- How to verify the change
- Send one HEAD request each for /composer.json and /composer.lock to your staging copy with a command that prints only the status code, such as curl -s -o /dev/null -w '%{http_code}' -I followed by the URL, and record only the status codes.
C1. Output encoding
- What the documentation says
- htmlspecialchars page: converts &, ", ', < and >, the double quote unless ENT_NOQUOTES is set and the single quote only when ENT_QUOTES is set; the default flags have been ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 since PHP 8.1.0; flags naming none of ENT_COMPAT, ENT_QUOTES or ENT_NOQUOTES default to ENT_NOQUOTES; input with an invalid code unit sequence returns an empty string unless ENT_IGNORE or ENT_SUBSTITUTE is set, and ENT_IGNORE is discouraged; the encoding defaults to default_charset, and naming the correct value is highly encouraged where default_charset may be set incorrectly for the input.
- Where to look, or the pattern (not run)
- Pattern (not run): echo htmlspecialchars($comment, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML5, 'UTF-8'); for text placed in an HTML body or a quoted attribute. Search: echo, print and short echo tags that output a variable without it, and htmlspecialchars calls whose flags leave out ENT_QUOTES or include ENT_IGNORE.
- What to write down
- Each file and line that outputs a value without encoding, and each call whose flags leave out ENT_QUOTES or include ENT_IGNORE.
- How to verify the change
- Repeat the search after the fix and record the count before and after. On staging, as a test account, save one test record whose text includes < > " ' and &, view the page source to confirm each character appears as an entity, then delete the record.
C2. Prepared statements
- What the documentation says
- PDO prepared statements page: parameters do not need quoting, and if an application exclusively uses prepared statements, the developer can be sure no SQL injection will occur, though SQL injection is still possible if other portions of the query are built up with unescaped input; a placeholder must be used in the place of the whole value, not inside a quoted LIKE pattern, and the corrected example passes the wildcards inside the bound value; PDO emulates prepared statements for drivers that do not support them.
- Where to look, or the pattern (not run)
- Pattern (not run): $statement = $pdo->prepare('SELECT id, total FROM orders WHERE customer_id = ? AND reference LIKE ?'); $statement->execute([$customerId, '%' . $search . '%']); Search: query( and exec( calls, and SQL strings joined with request or stored values.
- What to write down
- Each query built from strings with request or stored values, each table, column or sort name that comes from input, and each placeholder inside quotes.
- How to verify the change
- Repeat the search after the fix, record the count before and after, and run the application's own test suite on staging. The SQL injection guide covers names a placeholder cannot carry.
C3. Upload validation
- What the documentation says
- POST uploads page: the name is the client's original file name, the type comes from the browser and is not checked by PHP, full_path cannot be trusted, and size can be used to throw away files. move_uploaded_file page: it moves only files uploaded through PHP's HTTP POST mechanism and overwrites an existing destination file. finfo_file page: returns a description of the contents, and its example uses FILEINFO_MIME_TYPE for the MIME type. random_bytes page: cryptographically secure bytes that may need encoding before display.
- Where to look, or the pattern (not run)
- Pattern (not run): check that $_FILES['document']['error'] === UPLOAD_ERR_OK and the size is within your limit; read the type with finfo_file(finfo_open(FILEINFO_MIME_TYPE), $_FILES['document']['tmp_name']) and compare it with an allow-list; build the stored name from bin2hex(random_bytes(16)) and an extension taken from the allow-list, not from the upload; then move_uploaded_file() into a folder outside the document root. Search: every use of $_FILES.
- What to write down
- Each upload handler, whether it trusts the type or name entries, where files are stored, whether that folder is served, and the security.limit_extensions value from A13.
- How to verify the change
- On staging, as a test account, upload one text file you made, renamed with an image extension. Confirm it is refused, or stored under a generated name outside the document root, then delete it. The file upload security guide has further fixtures.
C4. Session cookies and a new ID at sign-in
- What the documentation says
- Session Management Basics: session IDs must be regenerated when privileges are elevated, such as after authenticating, with session_regenerate_id() called before the authentication information is written to $_SESSION; session_regenerate_id(true) and session_destroy() must never be called together for an active session, and instead of deleting outdated sessions immediately, developers must set a short expiry timestamp in $_SESSION and prohibit access to the session data themselves. session_regenerate_id page: delete_old_session defaults to false, and the function does not handle unstable networks well.
- Where to look, or the pattern (not run)
- Pattern (not run): in php.ini or the pool file, session.use_strict_mode = 1, session.cookie_secure = 1, session.cookie_httponly = 1 and session.cookie_samesite = "Lax"; at sign-in, session_regenerate_id(); and only then $_SESSION['user_id'] = $userId; with an expiry timestamp on the old session, as the Session Management Basics page describes. Search: session_regenerate_id, session_destroy and every place a signed-in flag is written to $_SESSION.
- What to write down
- Where sign-in and role changes regenerate the ID, and any place session_regenerate_id(true) is paired with session_destroy() for an active session.
- How to verify the change
- Repeat the search after the change, record where the sign-in code now calls session_regenerate_id() relative to the line that writes the signed-in flag, and run the application's own test suite on staging. Comparing the cookie's value before and after sign-in would put the session ID on screen, so this checklist leaves that comparison out.
C5. Error display
- What the documentation says
- PHP-FPM page: its example pool sets php_flag[display_errors] = off, php_admin_value[error_log] and php_admin_flag[log_errors] = on, and admin values cannot be overridden with ini_set(). Error Reporting page: the function, file and line number that failed are information that can be exploited, and its probing example sends errors, showerrors and debug parameters. Error handling configuration page: display_errors set with ini_set() has no effect if the script has fatal errors.
- Where to look, or the pattern (not run)
- Pattern (not run): in the pool file, php_admin_flag[display_errors] = off, php_admin_flag[log_errors] = on and php_admin_value[error_log] = /var/log/php/app-error.log, a path outside the document root. Using php_admin_flag for display_errors is this page's suggestion. Search: ini_set('display_errors' and error_reporting( calls, and request parameters such as debug, errors or showerrors that change error output.
- What to write down
- Each ini_set or error_reporting call, each request parameter that changes error output, and the pool lines.
- How to verify the change
- Read the pool file again after the change, repeat the search, and confirm the staging error log receives entries at the new path.
C6. Deserialisation boundary
- What the documentation says
- unserialize page: do not pass untrusted user input to unserialize() regardless of the allowed_classes option, and unserialisation can result in code being loaded and executed due to object instantiation and autoloading; use a safe, standard format such as JSON, through json_decode() and json_encode(), for serialised data passed to the user; consider hash_hmac() for externally stored serialised data; omitting allowed_classes is the same as true. json_decode page: depth defaults to 512, and null is returned for JSON that cannot be decoded or is deeper than the limit. hash_equals page: a timing attack safe comparison, with the user-supplied string second.
- Where to look, or the pattern (not run)
- Pattern (not run): $data = json_decode($body, true, 32, JSON_THROW_ON_ERROR); for stored serialised data that cannot move yet, check hash_equals(hash_hmac('sha256', $payload, $signingKey), $signature) before unserialize($payload, ['allowed_classes' => false]), with the key read from configuration rather than written in code. Search: unserialize( and every place its input comes from a cookie, request, cache, queue or file.
- What to write down
- Each unserialize() call, where its input comes from, whether allowed_classes is set, and whether a signature is checked first.
- How to verify the change
- Repeat the search after the change and record how many calls still read data from outside the application. The insecure deserialisation guide covers moving a feature to JSON.
Where PHP sits in a web application, and what this guide covers
PHP is both the language a PHP application is written in and the interpreter that runs it.
PHP runs through a server API, or SAPI. Web requests reach it through a server API, for example PHP loaded as an Apache module or a pool of PHP-FPM workers that accepts FastCGI requests, while the command-line binary runs scheduled jobs and deployment scripts.
The PHP documentation on the configuration file explains why that matters. php.ini is read when PHP starts: once, when the web server starts, for the server module versions, and on every invocation for CGI and the command line.
PHP looks for a php-SAPI.ini file before a plain php.ini, and may then scan a further directory for extra .ini files.
Because PHP looks for a file named after the server API first, the command line and the web server can load different files. This page's conclusion: a value read with php on the server's command line is not proof of what a web request runs with. The checklist records each value for the server API that actually serves the site, and records the command line separately where it differs.
Around the interpreter sit the packages Composer installs. Composer's basic usage guide calls the vendor directory the conventional location for all third-party code in a project, and describes composer.lock as the file that holds the exact version of every package.
Above those sit a framework or platform and your own code. Framework conventions have their own guides: the Laravel guide covers Laravel's settings and routes, and the WordPress, Drupal, Joomla and Magento guides cover theirs.
This page covers the layer underneath: supported PHP branches, php.ini directives, PHP-FPM pool settings, Composer, and six code patterns for output encoding, prepared statements, upload validation, session cookies, error display and deserialisation boundaries.
PHP security vulnerabilities: what the PHP project treats as its own, and what it does not
A PHP security vulnerability can be a flaw in the interpreter, closed by a PHP release, or a flaw in the code running on it, which no PHP release touches.
The PHP project's vulnerability disclosure policy sets out which bugs the project classifies as security issues. It classifies as security issues the bugs that allow users to execute unauthorised actions, cross security boundaries, access data that is not intended to be accessible, or severely impact the accessibility or performance of the system.
It sorts them into high, medium and low severity, and says the sorting is in many aspects subjective and ultimately relies on the judgement of the PHP developers.
For an application owner, the useful part is the policy's list of what is not a security issue. Among other things it excludes any issue that requires passing malicious arguments to functions clearly not intended to receive values that have not been sanitised, with mysqli_query() as its example; that requires settings not recommended for production, with error reporting to output as its example; that requires code or settings known to be insecure; that requires an open_basedir bypass; or that requires the built-in web server.
The SECURITY.md file in the php-src repository gives its own list of issues commonly reported that are not considered security issues, and that list includes open_basedir or disable_functions bypasses and malicious unserialize() inputs.
The same file says PHP does not offer sandboxing, and that the execution of untrusted code is always considered unsafe.
This page reads those lists as a division of work. Upgrading PHP closes the interpreter flaws a release fixes. A query built from request input, an unserialize() call that reads a cookie, display_errors left on in production, and reliance on open_basedir to keep one site out of another all stay with whoever owns the application, because the project does not treat them as its own security issues.
For the interpreter itself, the php/php-src repository on GitHub lists published advisories on its Security Advisories page, which carries the line "View known security vulnerabilities and report new vulnerabilities privately to maintainers."
Which PHP versions still receive security fixes
php.net's Supported Versions page sets out the life of a release branch.
Each branch is fully supported for two years from its initial stable release, and in that time reported bugs and security issues are fixed in regular point releases. It then gets two more years of fixes for critical security issues only, with releases made as needed: there may be several point releases in that time, or none, depending on the number of reports. Once the four years are complete, the branch reaches end of life and is no longer supported.
The table changes as branches age, so read it on the day you check. On 15 November 2026 it listed these. 8.2 had active support until 31 December 2024 and security support until 31 December 2026. 8.3 had active support until 31 December 2025 and security support until 31 December 2027. 8.4 had active support until 31 December 2026 and security support until 31 December 2028. 8.5 had active support until 31 December 2027 and security support until 31 December 2029.
The Unsupported Branches page gave 8.1 an end of life date of 31 December 2025, with 8.1.34 as its last release, and gave 8.0 and 7.4 end of life dates of 26 November 2023 and 28 November 2022.
End of life is the line that matters for a running site. The Supported Versions page says users of an end of life release should upgrade as soon as possible, as they may be exposed to unpatched security vulnerabilities. The Unsupported Branches page says older versions may expose users to security vulnerabilities and bugs that have been fixed in more recent versions.
The security chapter of the PHP documentation adds the general advice to update often and keep aware of new versions and their changes. This page's advice is narrower: a production branch past its security support date goes on the checklist as a finding by itself, even when no advisory names it, and the move to another branch is best planned before the one you run reaches that date.
Read the version from the place that serves requests. The PHP documentation's example for php -v prints the version together with the server API it belongs to, cli for the command line. This page's caution: the PHP that answers web requests can be a different installation from the one on the command line, so read both, taking the web version from your host's PHP settings or from the PHP-FPM service on the server. composer.json can also declare the PHP range an application needs, and the Composer section below covers the platform setting, which can fake the PHP version Composer checks that range against.
php.ini directives that change what PHP exposes
Every directive has a built-in default, and the PHP documentation's page of core directives is careful about what that means: the defaults it lists are used when php.ini is not loaded, and the values in the production and development php.ini files may vary.
PHP ships both files. The php.ini-production file in the php-src PHP-8.5 branch, read on 15 November 2026, says it holds security, performance and best practices at its core, warns that its settings may break compatibility with older or less security-conscious applications, and recommends it for production and testing environments.
So for each directive below, the built-in default, the value the production file sets and the value your server actually loads can all differ.
Where a value can be set depends on its mode, which the PHP documentation's page on where a setting may be set explains. INI_SYSTEM entries go in php.ini or httpd.conf. INI_PERDIR entries can also go in .htaccess or .user.ini. INI_USER entries can be set in scripts with ini_set(), in the Windows registry or in .user.ini, and INI_ALL entries can be set anywhere. .user.ini files are read only by the CGI and FastCGI server API, from the requested file's folder up to the document root, and are re-read every 300 seconds by default.
A PHP-FPM pool file can set values too: the FPM configuration page says php_value and php_flag overwrite earlier values, with the exception that disable_functions set there is appended to the php.ini value rather than replacing it, and that values set with php_admin_value and php_admin_flag cannot be overridden with ini_set(). php --ini, an option the command line options page says is available only in CLI, lists configuration file names and scanned directories, and from PHP 8.5.0, php --ini=diff shows how the loaded files differ from the defaults.
The error handling configuration page gives display_errors and display_startup_errors both a default of "1"; before PHP 8.0.0 display_startup_errors defaulted to "0". The production file sets both to Off. The PHP documentation's note on display_errors says it is a feature to support your development and should never be used on production systems, such as systems connected to the internet, and the same page strongly recommends keeping display_startup_errors off except for debugging.
It also says display_errors set at runtime with ini_set() has no effect if the script has fatal errors.
This page's reading: for a script with fatal errors the configured value is the one that applies, so a line of code that switches display off cannot stand in for it.
log_errors defaults to "0", and the production file sets it to On. The documentation strongly advises using error logging in place of error displaying on production web sites, and when error_log is not set, errors go to the server API's own error logger, such as Apache's error log.
The security chapter's page on error reporting explains what the display gives away: the details that help a developer debug, such as the function, the file and the line number that failed, are all information that can be exploited.
For deployment it says to either switch error reporting off entirely by setting error_reporting() to 0, or turn display_errors off, and with the latter, to define error_log and turn log_errors on as well.
zend.exception_ignore_args belongs with these. The production file sets it to On, against a built-in default of Off, and recommends turning it on in production to prohibit the output of sensitive information in stack traces.
With expose_php on, the core directives page says PHP exposes to the world that it is installed on the server, including its version in an HTTP header, and its example is an X-Powered-By header. The built-in default is "1", it can be set in php.ini only, and the production file leaves it On with a comment that it is no security threat in any way but makes it possible to determine whether you use PHP.
The security chapter's page on hiding PHP says that in general, security by obscurity is one of the weakest forms of security, and that turning expose_php off reduces the information available to an attacker.
This page treats switching it off as tidying that is worth doing, and no substitute for running a supported branch.
allow_url_fopen enables the URL-aware fopen wrappers that give access to URL objects like files, and the filesystem configuration page says the default wrappers reach remote files over the ftp or http protocol. It defaults to "1", and the production file keeps it On. allow_url_include lets include, include_once, require and require_once use those same wrappers; it defaults to "0", needs allow_url_fopen on, is deprecated as of PHP 7.4.0, and the production file sets it Off.
Both are INI_SYSTEM settings.
On this page's reading, with allow_url_include on, a path that reaches an include statement from outside could name code held on another server, which is why its checklist row also lists every include whose path is a variable.
open_basedir and disable_functions can look like a fence between sites, and the PHP documentation warns against relying on either for security. open_basedir limits the files PHP can access to a directory tree; its default is to allow all files to be opened; it does not restrict access to Unix domain sockets; and the documentation calls it just an extra safety net, in no way comprehensive, that cannot be relied upon when security is needed. disable_functions takes a list of internal functions, must be set in php.ini, and carries a warning that it can be circumvented and should not be considered a sufficient security measure for shared hosting environments.
SECURITY.md lists bypasses of either setting among issues not considered security issues, and the disclosure policy excludes any issue that requires an open_basedir bypass.
The FPM page adds that pools are not a security mechanism either, because they do not provide full separation, and gives a single OPcache instance shared by all pools as its example. Where sites share a server, the checklist asks you to record what actually keeps them apart.
file_uploads defaults to "1", upload_max_filesize to "2M", post_max_size to "8M" and max_file_uploads to 20. post_max_size must be larger than upload_max_filesize, and when a request's post data is larger than post_max_size, $_POST and $_FILES are empty. upload_tmp_dir is unset by default, and PHP then uses the system's default temporary directory.
These limits belong to the server: the POST uploads page says the MAX_FILE_SIZE field in a form is easy to fool, while the server-side settings for maximum size cannot be fooled.
If an application takes no uploads, this page suggests turning file_uploads off. It is an INI_SYSTEM setting, which the modes page places in php.ini or httpd.conf.
The session configuration page gives session.use_strict_mode, session.cookie_secure and session.cookie_httponly a default of "0", and session.cookie_samesite an empty default, which means no SameSite attribute is set. session.use_only_cookies defaults to "1" and session.use_trans_sid to "0", and from PHP 8.4.0 disabling the first or enabling the second is deprecated. The production file does not change the first group: it sets session.use_strict_mode to 0, leaves session.cookie_secure commented out, and leaves session.cookie_httponly and session.cookie_samesite empty.
Its comment on strict mode says it protects applications from session fixation via a session adoption vulnerability, and is disabled by default for maximum compatibility, but enabling it is encouraged.
The PHP documentation's page on securing session INI settings is more direct. It says developers are responsible for hardening session settings, and that enabling session.use_strict_mode is mandatory for secure sessions. It says session.cookie_httponly refuses access to the session cookie from JavaScript, that a website only accessible over HTTPS should enable session.cookie_secure, and it lists session.cookie_samesite as "Lax" or "Strict".
The configuration page adds its own cautions. If a custom save handler does not implement validateId() or supply the validate_sid callback, strict mode is effectively disabled whatever the directive says.
And with the default files handler, its warning says a save path set to a world-readable directory, such as /tmp, which the warning calls the default, may let other users on the server hijack sessions by getting the list of files in it; the same page's table gives session.save_path a default of "". The cookie security guide in this library explains what each cookie attribute does in the browser.
Where PHP runs as PHP-FPM, each pool file holds settings that sit outside php.ini. The FPM configuration page warns that an exposed FastCGI endpoint allows arbitrary code execution. It prefers a Unix socket when the web server runs on the same host, with access to it then controlled on Linux by listen.owner, listen.group and listen.mode, and it notes that many BSD-derived systems accept connections regardless of those permissions.
When a TCP socket is used, the addresses allowed to connect must be listed in listen.allowed_clients, which is unset by default and then accepts any address, and in container setups the FPM port should not be published on the host.
It adds that settings passed from the web server reach php-fpm as FastCGI headers, so php-fpm should not be bound to a worldwide accessible address, otherwise anyone could alter the PHP configuration options. security.limit_extensions defaults to .php .phar, and the page says FPM should be limited to .php extensions so that other extensions cannot be used to execute PHP code.
Composer: the lock file, dev packages, advisories and plugins
Composer decides which third-party code reaches the server.
Its basic usage guide says the update command resolves the dependencies in composer.json and writes the exact version of every package to composer.lock, and that the lock file should be committed so the CI server, production machines and other developers all run on the same dependencies.
Run with a lock file present, install uses the exact versions in it, and Composer warns when composer.lock has not been updated since changes to composer.json that might affect dependency resolution.
This page's reading: production should run install from the committed lock file, not update, so the code on the server is the code that was reviewed.
The command-line reference adds the flags that change what lands there. install --no-dev skips the packages listed in require-dev, and autoloader generation skips the autoload-dev rules. audit checks installed packages against dependency policies such as security advisories, looking advisories up through the Packagist.org API by default, or through other repositories that composer.json names, and also detects abandoned packages and packages flagged as malware.
It exits with 0 when it finds no issues, and with 1 when it found packages matching dependency policies or failed because required packages were missing; --locked audits the packages the lock file lists, whatever the vendor folder holds; and install --audit runs an audit once installation is complete.
The dependency security guide covers reading an advisory against your own use of a package and deciding what to update first.
Composer's configuration chapter sets several defaults worth recording. Under policy, advisories.block defaults to true, which means package versions with active security advisories are blocked during update, require and remove unless the advisory or package is ignored; the same page notes that dev-* versions from branch names are never blocked. allow-plugins defaults to {}, which does not allow any plugins to be loaded, and from Composer 2.2.0 it lets you restrict which plugins are able to execute code during a Composer run. secure-http defaults to true, so only HTTPS URLs are allowed to be downloaded. disable-tls defaults to false; the page calls enabling it a security risk and says doing so implicitly disables secure-http.
The command-line reference lists environment variables that override certain settings and says they always take precedence over the values in composer.json.
Among them, COMPOSER_POLICY_ADVISORIES_BLOCK set to 0 disables advisory blocking, and COMPOSER_NO_BLOCKING set to 1 disables all policy based blocking.
On this page's reading, a build job's environment can switch blocking off while composer.json stays the same, so the checklist reads both.
The last checks in this section close the gap between what Composer assumes and what the server is. The platform setting lets a project fake its PHP and extension versions; the configuration page says the dependencies are then not checked correctly any more, and recommends running check-platform-reqs as part of deployment.
That command checks the real PHP and extension versions against the installed packages and ignores the platform setting. Last, this page's own advice: keep vendor, composer.json and composer.lock outside the web server's document root.
Composer's guide says composer.json typically goes in the top-most directory of the project, and on this page's reading a lock file served to the public is a list of every package and version the site runs.
Six code patterns, and what the PHP documentation says about each
The last six rows of the checklist are short patterns to compare with your own code, each paired with the search that finds where your code differs.
They were written for this page and were not run, because no PHP interpreter was available where the page was prepared, so the page shows no output for them. Each function's behaviour below is credited to its own PHP documentation page, and each subject has a fuller guide elsewhere in this library.
htmlspecialchars() converts &, double quotes, single quotes, < and > to HTML entities, and the quotes depend on its flags: the double quote is converted unless ENT_NOQUOTES is set, and the single quote only when ENT_QUOTES is set.
Since PHP 8.1.0 the default flags have been ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401; before that the default was ENT_COMPAT. A note on the function page matters for code that passes its own flags: when none of ENT_COMPAT, ENT_QUOTES and ENT_NOQUOTES is present, the default is ENT_NOQUOTES, which leaves both kinds of quote unconverted. On that reading, a call that passes only ENT_HTML5 converts neither.
Without ENT_IGNORE or ENT_SUBSTITUTE, input with an invalid code unit sequence returns an empty string, and the page discourages ENT_IGNORE because it may have security implications. The encoding defaults to the default_charset setting, and the page highly encourages naming the correct value where that setting may be wrong for the input.
When the input and the final document share a character set, it calls the function sufficient to prepare input for most contexts of an HTML document. The cross-site scripting guide covers the places HTML encoding is the wrong tool, such as JavaScript, URLs and CSS.
The PDO documentation says the parameters to prepared statements do not need to be quoted, because the driver handles it, and that if an application exclusively uses prepared statements the developer can be sure no SQL injection will occur. It keeps a condition in the same sentence: if other portions of the query are being built up with unescaped input, SQL injection is still possible.
Its example of invalid use puts a placeholder inside a quoted LIKE pattern, its comment says a placeholder must be used in the place of the whole value, and its corrected line passes the wildcards inside the bound value.
PDO emulates prepared statements for drivers that do not support them. The SQL injection guide covers the parts of a query a placeholder cannot carry, such as table and column names and sort order.
The POST uploads page is plain about what arrives with a file. The name entry in $_FILES is the original name of the file on the client machine. The type entry is the MIME type the browser supplied, which PHP does not check, so the page says not to take it for granted and to use it only as the first of a series of checks.
The full_path entry, available from PHP 8.1.0, cannot be trusted, and the size entry can be used to throw away files that are too small or too big. move_uploaded_file() checks that a file was uploaded through PHP's HTTP POST upload mechanism before it moves it, and its documentation warns that a destination file that already exists will be overwritten.
finfo_file() returns a textual description of a file's contents, and its documentation's example opens finfo with FILEINFO_MIME_TYPE to return a MIME type. random_bytes() returns cryptographically secure random bytes, and its page says they may need encoding before display, which is why the pattern passes them through bin2hex() to build a stored name. The file upload security guide covers storage, download headers, archives and files that carry active content.
The cookie attributes are configuration, so the first half of this pattern is php.ini or pool lines; the code part is sign-in. The PHP documentation's page on session management basics says session IDs must be regenerated when user privileges are elevated, such as after authenticating, and that session_regenerate_id() must be called before the authentication information is written to $_SESSION.
The same page says active session data must not be removed immediately: session_regenerate_id(true) and session_destroy() must never be called together for an active session, and instead of deleting outdated sessions immediately, developers must set a short expiry timestamp in $_SESSION and prohibit access to the session data themselves.
The function's own page gives delete_old_session a default of false and warns that it does not handle unstable networks, such as mobile and Wi-Fi, well, so a session may be lost. The session management guide covers timeouts, sign-out and revocation.
In code, the pattern is an absence: no ini_set() call that turns display_errors on, and no request parameter that does. The security chapter's page on error reporting shows an attacker's form sending errors, showerrors and debug parameters to a page, as an example of trying common debugging strings.
In configuration, the FPM page's example pool sets display_errors off with php_flag, and error_log and log_errors with php_admin_value and php_admin_flag. Setting display_errors with php_admin_flag as well is this page's suggestion, because the FPM page says admin values cannot be overridden with ini_set(). The security misconfiguration guide covers verbose error output and debug mode exposure beyond PHP.
The unserialize() documentation warns not to pass untrusted user input to it, regardless of the allowed_classes option, and says unserialisation can result in code being loaded and executed due to object instantiation and autoloading. It points to a standard format such as JSON, through json_decode() and json_encode(), for serialised data passed to the user, and suggests considering hash_hmac() to validate externally stored serialised data.
Leaving allowed_classes out is the same as setting it to true. json_decode() returns associative arrays when its associative argument is true, has a default nesting depth of 512, and returns null when the JSON cannot be decoded or is deeper than the limit; its changelog lists JSON_THROW_ON_ERROR as added in PHP 7.3.0. hash_equals() checks whether two strings are equal without leaking information about the contents of the known string through execution time, and its page cautions that the user-supplied string goes second. The insecure deserialisation guide covers formats that carry types and how to move a feature off them.
How to fill in the evidence checklist
Whoever looks after the application's servers and code keeps this checklist, or passes it to someone who does the reading for them.
Copy the table into a spreadsheet, with a separate copy per environment.
- Cover each environment that can be reached from the internet, including production, staging and any preview or demo site. An old copy left running on a past branch, or with display_errors on, still answers requests.
- Rows A1 to A14 read the PHP runtime and its configuration, rows B1 to B5 read Composer, and rows C1 to C6 are code searches against the six patterns. For each, write down what the fourth column asks for, with the date and who read it.
- Read each php.ini value for the server API that serves the site. Where the command line and the web server load different files, record both.
- Leave phpinfo() out of it. Its documentation says it outputs the master and local values of configuration options and also contains all EGPCS (Environment, GET, POST, Cookie, Server) data. On this page's reading, that can include any secret kept in an environment variable, so a phpinfo page left on a server is a finding in itself.
- For any secret, write down facts about it and never the value itself: whether it is set, where it lives and who can read it. Database passwords, API keys, the signing key in row C6 and session cookie values all fall under this.
- Leave every setting as it is while you read. When a row turns up something that should change, hand it as a task to whoever owns that server or that code, to go through your usual release process, and use the last column afterwards to confirm the change.
- The few verification steps that send a request to the site go only to your own staging copy, one request at a time, and those that sign in or upload use a test account and files you made. Delete anything a step creates. composer audit in row B2 also sends requests beyond your site: Composer's command-line reference says it looks advisories up through the Packagist.org API by default, or through the repositories composer.json names.
What a review of your own setup cannot show
A filled-in checklist records versions, settings and search results on the day they were read.
Its limits are worth writing down beside it.
- A branch inside its support dates still gets the fixes the Supported Versions page describes for its stage. That does not tell you that your server has installed the point release that carries them.
- A value read from a file is the value in that file. A .user.ini file, a pool line or an ini_set() call elsewhere can change what a request runs with, which is why row A3 exists.
- composer audit checks installed packages against its dependency policies, such as published advisories. A flaw in a package that no advisory or policy covers, and your own code, are outside it.
- A code search finds the patterns it looks for. Access control, business rules and the way one feature calls another are outside it.
- A staging result describes staging. Production can run a different branch, php.ini or pool file.
- Whether anyone has already misused the application, say while display_errors was on or while an unserialize() call read a cookie, is outside the checklist. That is a question for incident response: call an incident response specialist first.
Where a Clever Ops assessment fits
This page is informational, and no PHP-specific service sits behind it.
Nothing here is a test of PHP, PHP-FPM or Composer themselves: the checklist is written for the people who build and run a PHP application, to fill in from their own servers and repository.
Where your PHP application is a custom web application, testing it actively falls inside the scoped web application penetration test that Clever Ops runs for custom web applications and the APIs behind them, with Laravel applications the exception set out below. The tester signs in with test accounts for every role in the scope and works through both the application and its API.
For each role the scope requests a pair of test accounts, both holding sample records, so each account can be tried against the other one's records. You receive a written scope and sign an authorisation for each target, and testing then runs in an agreed window.
A secure code review instead reads your repository through read-only access, and its written scope names the part of the codebase it covers, for instance the authorisation layer along with each route that returns customer data.
Laravel applications are outside the web security services Clever Ops offers: there is no Laravel audit, Laravel penetration test or code review of a Laravel application, and the Laravel guide in this library is informational, meant for your own developers or for a provider that does test Laravel applications.
For a WordPress site, the WordPress security audit is the closer fit. An application Clever Ops built or hosts gets a security review in place of an independent penetration test, and the report records which party built the application and which hosts it. Clever Ops does not take on round-the-clock monitoring, and emergency incident response is outside its work too.
Frequently asked questions
Read php.net's Supported Versions page on the day you check. On 15 November 2026 it listed 8.2, 8.3, 8.4 and 8.5, with security support until 31 December 2026, 2027, 2028 and 2029 in that order, and the Unsupported Branches page listed 8.1 as end of life from 31 December 2025. Each branch is fully supported for two years from its initial stable release and then supported for two more years for critical security issues only, after which it reaches end of life and is no longer supported.
The PHP documentation's error handling configuration page says display_errors is a feature to support your development and should never be used on production systems, such as systems connected to the internet. The same page gives a built-in default of "1" and says php.ini-production sets it to Off, so what a site does depends on which file the server loads. It also strongly advises error logging in place of error displaying on production web sites, and the security chapter says that with display_errors off you should define error_log and turn log_errors on.
It converts &, quotes, < and > to HTML entities, and the PHP documentation calls it sufficient for most contexts of an HTML document when the input and the page share a character set. Its flags can still catch code out: the single quote is converted only when ENT_QUOTES is set, and flags that name none of ENT_COMPAT, ENT_QUOTES or ENT_NOQUOTES default to ENT_NOQUOTES. Values placed inside JavaScript, URLs or CSS need the handling the cross-site scripting guide describes.
No. The unserialize() documentation warns not to pass untrusted user input to it regardless of the allowed_classes option, and says unserialisation can result in code being loaded and executed due to object instantiation and autoloading. For serialised data passed to the user it points to a safe, standard format such as JSON, through json_decode() and json_encode(), and for externally stored serialised data it suggests considering hash_hmac() for validation. PHP's SECURITY.md lists malicious unserialize() inputs among issues not considered security issues in PHP itself.
Composer's command-line reference says it audits installed packages against dependency policies such as security advisories, which it looks up through the Packagist.org API by default or through other repositories that composer.json names, and also detects abandoned packages and packages flagged as malware. It exits with 0 when it finds no issues, and with 1 when it found packages matching dependency policies or failed because required packages were missing, and --locked audits what composer.lock lists, whatever the vendor folder holds. It checks packages against those policies, so your own code is outside it.
The PHP documentation warns against relying on either for security. It calls open_basedir just an extra safety net, in no way comprehensive, that cannot be relied upon when security is needed, and warns that disable_functions can be circumvented and should not be considered a sufficient security measure for shared hosting environments. PHP's SECURITY.md lists open_basedir or disable_functions bypasses among issues that are not considered security issues.
Scope the right test for your application
Tell us what you have built, who uses it and when it needs to launch. You will get a plain-English recommendation: a website audit, a web application test or a referral to a specialist.