Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk8 min

Where to Find the PHP Error Log File on Linux

Linux has no universal PHP error-log filename. Learn how to identify the active PHP SAPI, read its effective configuration and locate errors in a file, Apache or NGINX log, PHP-FPM journal, syslog or container stderr.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

There is no single PHP error-log filename on Linux. The correct destination depends on the PHP SAPI handling the request (CLI, Apache, CGI or PHP-FPM), the active configuration, and whether logging is directed to a file, syslog, journald or standard error. Start by reading the effective configuration for the SAPI that actually runs your code; do not assume that a path such as /var/log/php_errors.log exists.

PHP’s error_log setting can name a file, use the special value syslog, or be empty. When it is empty, PHP hands errors to the active SAPI logger, which may be Apache’s error log or the CLI process’s stderr. NGINX has a separate error_log setting, while PHP-FPM pools can add worker and slow-request logs of their own.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Find the effective PHP configuration first

The file you edit is less important than the configuration PHP loaded for the failing request. A command-line script and a web request commonly use different php.ini files, and separate PHP-FPM pools may override global values.

Check the CLI SAPI

Run these commands as the same user and on the same host where the script runs:

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
php --ini
php -i | grep -E 'log_errors|error_log|Loaded Configuration File'

php --ini shows the main file and scanned additional-ini directory. The second command prints the loaded configuration file and the effective values for log_errors and error_log. If the command reports error_log => no value, PHP is not configured with a dedicated file and will use the CLI SAPI logger, normally the terminal’s standard error stream.

Check the web SAPI

A CLI result does not prove where a browser request is logged. For a temporary diagnostic page, expose phpinfo() only to a trusted administrator, inspect the “Loaded Configuration File,” “Additional .ini files parsed,” “log_errors,” and “error_log” rows, then remove or protect the page immediately. You can also inspect the PHP-FPM pool configuration and the service unit, because pool-level directives can override global PHP settings.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Confirm that the request reaches the expected SAPI. A site served by NGINX normally passes PHP to PHP-FPM; an Apache installation may use an embedded PHP module or proxy to FPM. A command-line test, an Apache module and an FPM pool can therefore produce different destinations for the same script.

Interpret the error_log value

Effective value Where to look What it means
Absolute file path, such as /var/log/myapp/php-error.log That exact file PHP appends errors there, provided the service account can open the file and traverse its parent directories.
Relative file path The path resolved by the running SAPI and process environment It is a file destination, but the resulting absolute location can differ between CLI, Apache and FPM. Resolve it from the service configuration rather than guessing.
syslog The host’s system logger, often queried through journald or a syslog collector PHP sends messages to the operating-system logger instead of creating a PHP-specific file.
Empty or “no value” The active SAPI logger: Apache’s error log, CLI stderr, or another server logger PHP has no dedicated destination configured.

The PHP documentation defines error_log as the file used for script errors, notes that the file must be writable by the web-server user, and documents syslog as the system-logger destination. See PHP Runtime Configuration. The log_errors directive must also be enabled; otherwise ordinary PHP errors are not written to the configured destination.

Apache: locate the server error log

When PHP runs as an Apache module and PHP’s error_log is unset, messages may appear in Apache’s configured error log. Apache’s ErrorLog directive sets the file receiving server errors, as documented by the Apache HTTP Server 2.4 core documentation.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Find the active ErrorLog directive

Search the configuration tree used by your distribution:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo grep -RIn --include='*.conf' '^[[:space:]]*ErrorLog' /etc/apache2 /etc/httpd 2>/dev/null

Read the global configuration and the virtual-host block serving the affected site. A virtual host can override the global destination, so the first path you find is not necessarily the one receiving this request. Typical package layouts include an Apache error.log under /var/log/apache2/ on Debian-derived systems or under /var/log/httpd/ on Red Hat-derived systems, but the active ErrorLog line is authoritative.

Watch the file while reproducing the error

sudo tail -f /path/from/ErrorLog

Trigger one controlled failing request and watch for a new line. If nothing appears, verify that the request is using this virtual host, that PHP’s log_errors is enabled, and that the process can write the destination. Apache errors unrelated to PHP can also appear in the same file, so identify the timestamp, virtual host and request path before drawing conclusions.

NGINX and PHP-FPM: two logging layers

NGINX and PHP-FPM are separate processes. NGINX logs connection, proxy and configuration failures; PHP-FPM runs the PHP code and can log PHP errors, worker failures and slow requests. A missing PHP exception in NGINX’s file does not prove that PHP generated no error.

Determine NGINX’s compiled-in default

nginx -V 2>&1 | sed -n 's/.*--error-log-path=([^ ]*).*/1/p'

NGINX documents a default of logs/error.log, while the absolute path depends on the operating system and installation method. Distribution packages commonly resolve it to /var/log/nginx/error.log, but a custom prefix or source build can differ.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

Check configuration overrides

Inspect nginx.conf and included files for error_log directives in the main, http, server or location contexts. A lower-level directive can override an inherited value for one site or URL. The destination may be a file, stderr or a syslog: address.

sudo nginx -T 2>/dev/null | grep -nE '^[[:space:]]*error_log'

After changing NGINX configuration, validate and reload it:

sudo nginx -t
sudo systemctl reload nginx

Inspect the PHP-FPM service and pool

Find the service name installed on your system, then inspect its journal and pool files. Names vary by PHP version, for example php8.2-fpm or php-fpm.

systemctl list-units --type=service | grep -i fpm
sudo journalctl -u php8.2-fpm --since '15 minutes ago'
ps -ef | grep '[p]hp-fpm'

In the pool configuration, look for directives such as php_admin_value[error_log], php_admin_flag[log_errors], catch_workers_output, slowlog and request_slowlog_timeout. A worker log or slow log is not automatically the same as the PHP application error log. Check the pool included by the running master process, then restart or reload FPM after edits according to your distribution’s service policy.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Syslog, journald and container standard error

When PHP uses syslog

With error_log = syslog, PHP sends messages to the system logger. On a systemd host, query the relevant service rather than searching only for a file:

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
sudo journalctl -u php8.2-fpm
sudo journalctl -u apache2
sudo journalctl -u httpd
sudo journalctl -f

Use the unit that owns the SAPI handling the request. If a traditional syslog daemon is in use, inspect its facility and routing configuration to determine whether messages are written to a file, forwarded to another host or filtered.

When the destination is stderr

CLI errors are normally visible in the terminal’s standard error stream. In a service, systemd captures that stream in the unit journal unless the unit redirects it elsewhere. Container images frequently send NGINX or PHP-FPM output to stderr; use the runtime’s log command instead of looking for a host path, for example:

docker logs --follow <container-name>

The container name and runtime command are environment-specific. Kubernetes workloads similarly expose container streams through the pod-log mechanism, while a host-mounted file may not exist at all.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why PHP errors are not appearing

1. You checked the wrong SAPI

Compare the failing request with the configuration you inspected. A cron job may use CLI PHP while the website uses FPM; multiple PHP versions can also have separate configuration directories. Record the binary and loaded file for each context rather than assuming one global setting.

2. Logging is disabled

Check that log_errors is enabled in the effective web configuration. The display_errors directive controls screen output, not whether errors are logged. PHP describes display-on-screen behavior as a development feature and advises against exposing it on Internet-facing production systems; keep display disabled in production and rely on logs.

3. The file cannot be opened

The web-server or FPM worker account needs write permission on the file and execute (traverse) permission on every parent directory. Check both ownership and mode:

namei -l /path/to/php-error.log
sudo -u www-data test -w /path/to/php-error.log && echo writable

Replace www-data with the account shown by your Apache or FPM service. If the file does not exist, the account must be able to create it in the parent directory. Mandatory access controls such as SELinux or AppArmor can still deny access after Unix permissions look correct; inspect their audit or service logs when permission errors persist.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Rotation moved or truncated the file

Logrotate or another collector may rename the current file, compress older copies, recreate it with different ownership or truncate it while you are watching. Inspect rotation rules, timestamps and inode changes. After a rotation policy change, reload the service if required so it reopens the destination cleanly.

5. The request never reached PHP

A DNS, TLS, NGINX, Apache, routing or permission failure can stop execution before PHP starts. First check the web-server access and error logs, then confirm the request reaches the intended FPM socket or Apache handler. A PHP log cannot contain an error from code that was never invoked.

Testing a destination safely

For a controlled test, create a temporary script in a protected location that deliberately emits a benign warning, request it through the same SAPI as the failing application, and remove it immediately. You can also call PHP’s error_log() function from an administrative test script. Message type 0 uses the configured operating-system logger or file; message type 3 appends directly to the destination file. Do not use a production test to print secrets, credentials or customer data.

After the test, correlate the exact timestamp across the PHP, FPM, Apache, NGINX and system logs. This distinguishes a configuration problem from an application path that is not being executed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Production settings and operational safeguards

  • Enable log_errors for the production SAPI and keep display_errors disabled so stack traces and filesystem paths are not sent to visitors.
  • Choose a destination with defined retention, rotation and access controls. Error logs can contain request parameters, usernames, paths and exception details.
  • Grant the service account only the write access it needs; avoid making an entire log directory world-writable.
  • Monitor disk usage. A full filesystem can silently prevent new entries even when permissions are correct.
  • When using syslog or journald, configure retention and forwarding deliberately so messages are not lost during restarts or container replacement.
  • Document which PHP version, SAPI, pool, virtual host and service unit own each destination. This prevents a future administrator from debugging a CLI file while the site runs through another PHP installation.

A repeatable decision path

  1. Identify whether the failing code runs under CLI, Apache, CGI or PHP-FPM.
  2. Inspect that SAPI’s loaded configuration and included files.
  3. Read the effective log_errors and error_log values.
  4. If a file path is set, resolve it and verify service-account permissions, parent-directory traversal and rotation rules.
  5. If the value is syslog, query journald or the configured syslog collector.
  6. If it is empty, inspect the SAPI logger: Apache’s ErrorLog, the CLI terminal, the FPM service journal or the container’s standard-error stream.
  7. Reproduce one controlled error and correlate timestamps across the relevant logs.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.