If WordPress displays raw <?php code or your browser downloads index.php, Apache is serving the file without handing it to a PHP interpreter. Reinstalling Apache commonly removes the PHP handler, disables its module, or points the active virtual host at a different document root. Restore one working PHP path—either Apache’s PHP module or PHP-FPM—prove it with a temporary phpinfo() page, and only then troubleshoot WordPress itself.
Antihost offers managed WordPress hosting with free migration, one-click staging and a 14-day free trial.
What the symptom means
PHP files are supposed to be executed on the server. The browser should receive the generated HTML, not the PHP source. WordPress Developer Resources states that when <?php ?> tags reach the browser, PHP is not working properly.
- Raw PHP source or an index.php download: Apache has no usable PHP handler for that request, the handler is disabled, the wrong module or FPM version is selected, or the request is reaching a different virtual host and document root.
- A blank page or a WordPress critical-error screen: PHP is executing, so investigate WordPress, a plugin or theme, memory limits, incompatible PHP code, or damaged files.
- The home page works but post URLs return 404: this is normally an Apache rewrite problem, not a PHP-execution problem.
The command-line result from php -v does not prove that Apache can execute PHP. CLI PHP and the PHP SAPI used by web requests can be different versions or different builds.
As an Amazon Associate I earn from qualifying purchases.
Repair order at a glance
- Confirm which virtual host and
DocumentRootserve the request. - Create a temporary
phpinfo.phptest in that exact document root. - Choose one handler model:
mod_phpor PHP-FPM throughmod_proxy_fcgi. - Enable the matching module or FPM site configuration, then restart Apache and the FPM service as applicable.
- Check the PHP version, SAPI and required extensions in
phpinfo(); delete the test file immediately. - Validate WordPress’s database, files, permissions, configuration and logs.
- Handle pretty-permalink rewrites separately after PHP execution is confirmed.
1. Verify that Apache is serving the intended WordPress site
After a reinstall, it is easy to repair one virtual host while requests are handled by another. Check the enabled site configuration and read its DocumentRoot. Confirm that the directory contains the WordPress index.php, wp-admin, wp-includes and wp-content directories.
Also verify that DNS or the request’s IP address reaches the machine you are changing. A successful edit on one server cannot change a response generated by another.
#1 Best Overall
- [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.
Check the temporary PHP page
Create a file named phpinfo.php in the active document root with exactly:
<?php phpinfo(); ?>
Open https://your-domain.example/phpinfo.php (or the site’s HTTP URL if HTTPS is not yet configured). Ubuntu’s installation guidance uses this style of test because it shows the PHP version, SAPI, Apache information and loaded configuration.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →- If the page shows raw PHP or downloads, Apache still has no working PHP dispatch path. Continue to the handler sections.
- If it renders a PHP information page, note the PHP Version and Server API. The SAPI should match the model you selected: an Apache module for
mod_php, or FPM/FastCGI for PHP-FPM. - If it shows a different site’s details, fix the virtual-host selection or document root before changing PHP packages.
Delete phpinfo.php as soon as the check is complete. It exposes server paths, versions, modules and configuration details that should not be public.
2. Restore one PHP execution model
Apache should have one deliberate route for .php requests. Leaving an old Apache PHP module enabled while routing another version through FPM can produce confusing version mismatches and intermittent behavior.
| Characteristic | mod_php |
PHP-FPM with mod_proxy_fcgi |
|---|---|---|
| How Apache dispatches PHP | Apache loads the PHP module directly. | Apache proxies requests to a separate PHP-FPM process through FastCGI. |
| Apache MPM compatibility | Subject to the PHP module’s Apache MPM requirements. | Works with Apache’s proxy/FastCGI arrangement and avoids loading PHP into Apache workers. |
| Package/configuration path on Ubuntu | libapache2-mod-php supplies the module and configures Apache to run PHP scripts. |
Install the matching PHP-FPM service, enable proxy_fcgi and the site’s FPM configuration, and match the socket or TCP endpoint to the running FPM version. |
| Process management | PHP runs inside Apache’s process model. | PHP is managed separately by the FPM service, providing operational isolation from Apache. |
| Best fit | A straightforward Ubuntu setup where the available Apache MPM and PHP package support the module. | Modern deployments or environments that want PHP managed separately from Apache. |
The PHP Documentation Group recommends PHP-FPM with Apache’s mod_proxy_fcgi for modern deployments. The simpler mod_php route can still be appropriate when the distribution package and Apache MPM are compatible.
Rank #2
- 【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.
3. Ubuntu repair: the mod_php path
Install the runtime and Apache module
On Ubuntu, install the PHP runtime and the Apache integration package:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
sudo apt update
sudo apt install php libapache2-mod-php
The libapache2-mod-php package supplies the Apache module and its configuration. If more than one PHP version is installed, make sure the module enabled for Apache is the version you intend to run.
Enable the module and restart Apache
If the package did not enable the module automatically, enable the matching Apache PHP module with a2enmod. The exact module name includes the PHP version, for example php8.3:
sudo a2enmod php8.3
sudo systemctl restart apache2
Use the version actually installed on the machine rather than copying 8.3 blindly. Reopen phpinfo.php and verify both the PHP version and the Apache-module SAPI. If Apache refuses to restart, inspect its service status and error output before changing more files:
sudo systemctl status apache2
sudo journalctl -u apache2 -xe
A restart failure usually indicates a syntax error, duplicate module or virtual-host conflict. Correct that error, restart again, and retest the temporary PHP page.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #3
- [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
4. Ubuntu repair: the PHP-FPM path
Install and start the matching FPM service
Install the FPM package for the PHP version you intend Apache to use, then ensure its service is running. A versioned example is:
sudo apt update
sudo apt install php8.3-fpm
sudo systemctl enable --now php8.3-fpm
Substitute the installed PHP version. The FPM service, Apache configuration and socket must all refer to the same version.
Enable Apache’s FastCGI proxy support
Enable Apache’s proxy module for FastCGI and the distribution-provided FPM site configuration:
sudo a2enmod proxy_fcgi
sudo a2enconf php8.3-fpm
sudo systemctl restart apache2
Again, replace the version in the configuration name with the one installed. If your virtual host uses a custom socket or TCP endpoint instead of the distribution configuration, compare that endpoint with the FPM pool configuration and the running service. A stale socket path is a common reason for gateway errors or unexecuted PHP.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Confirm that Apache reaches FPM
Open phpinfo.php and check the Server API. It should identify FPM/FastCGI. If it still reports an Apache module, an old mod_php path is handling the request. If it downloads the file, the virtual host has no PHP handler. If it returns a 503 or gateway error, check that the FPM service is running and that Apache’s socket or TCP target exactly matches it.
Rank #4
- 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.
Do not leave competing mod_php and FPM handlers enabled for the same site. Disable the obsolete route, restart Apache, and repeat the SAPI check. Remove phpinfo.php when finished.
5. Check WordPress’s supported platform and PHP extensions
Once a standalone PHP page works, verify that the web SAPI—not only the CLI—meets WordPress’s current recommendations. The WordPress.org requirements page accessed October 15, 2026 recommends:
| Component | Recommended baseline |
|---|---|
| PHP | PHP 8.3 or greater |
| Database | MariaDB 10.11 or greater, or MySQL 8.0 or greater |
| Transport security | HTTPS |
| Web server capability | Apache or Nginx with mod_rewrite available for Apache |
Older PHP and database releases may continue to run legacy installations, but they are end-of-life and carry additional security risk. Plan an upgrade rather than treating compatibility as a permanent solution.
Confirm extensions and configuration
Use the loaded-module section of phpinfo() to confirm the extensions required by WordPress and by every installed plugin and theme. A CLI extension list can differ from the web SAPI’s list.
Check common execution limits if WordPress reports memory or upload failures. Compare the web SAPI’s values for memory, upload size and request time with what the site needs; change them only in the configuration file used by that SAPI, then restart the relevant service.
Best Value
Verify wp-config.php and database access
Open wp-config.php and verify the database host, database name, username and password. Confirm that the database server is reachable from the web server and that the account has the required privileges. A PHP handler can be fully repaired while WordPress still fails because its database credentials are wrong.
Check files and permissions
Apache or the FPM worker must be able to read WordPress core files and write only where WordPress legitimately needs to write, such as the uploads directory. Reinstalled Apache packages can change the service account or expose a different directory. Correct ownership and permissions for the active document root without making the entire site world-writable.
Recommended Free Tools
6. Diagnose a blank page or WordPress critical error
A blank page or critical-error message after phpinfo() works means the dispatch layer is no longer the primary fault. WordPress normally emails the administrator when it detects a fatal error. Read that message for the component and recovery mode link, then inspect:
wp-content/debug.log
The log can identify a plugin or theme conflict, incompatible PHP code, exhausted memory, or corrupted files. Enable WordPress debugging only as long as needed, protect the log from public access, and disable verbose display on a production site so visitors do not see stack traces.
Isolate extensions and custom code
- Use the recovery mode link from WordPress’s email, when available, to deactivate the named extension.
- If no email arrives, temporarily disable plugins through the administration area or by renaming the plugins directory, then restore them one at a time.
- Switch to a default theme to distinguish theme code from core or server failures.
- After identifying the failing component, update it for the active PHP version or replace it with a maintained alternative.
Do not keep deleting plugins or editing core files before reading the fatal-error details; that can remove evidence without repairing the underlying incompatibility.
7. Fix pretty-permalink 404s separately
If the front page and phpinfo.php work but URLs such as /sample-post/ return 404, PHP execution is already functioning. Focus on Apache rewriting:
- Enable the rewrite module:
sudo a2enmod rewrite. - Ensure the virtual host permits the WordPress directory’s
.htaccessrules, or place equivalent rewrite rules in the virtual-host configuration. - In WordPress, open Settings → Permalinks and select Save Changes to regenerate rewrite rules.
- Retest a post URL and review Apache’s error log if it still returns 404.
WordPress troubleshooting identifies Apache mod_rewrite as the remedy for this class of pretty-permalink failure. Do not change PHP handlers to fix a rewrite-only 404.
8. Failure patterns and the fastest corrective check
| Observed result | Most likely layer | Next check |
|---|---|---|
PHP source appears or index.php downloads |
Apache-to-PHP dispatch | Confirm the active virtual host, install or enable one handler, and inspect phpinfo.php. |
phpinfo.php works but WordPress is blank or critical |
WordPress code or runtime requirements | Read the administrator email and wp-content/debug.log; check extensions, memory, plugins and themes. |
| FPM gives 503 or a gateway error | FPM service or endpoint | Check the matching FPM service, socket/TCP path and Apache proxy_fcgi configuration. |
| Home page works; post URLs are 404 | Apache rewrite rules | Enable mod_rewrite, verify .htaccess or virtual-host rules, and resave permalinks. |
| Apache will not restart | Configuration or module conflict | Run systemctl status apache2 and journalctl -u apache2 -xe; fix the reported syntax or duplicate-handler error. |
9. Final verification checklist
- The request reaches the intended machine, virtual host and WordPress document root.
phpinfo.phpexecutes instead of downloading or exposing source.- The PHP version and SAPI match the selected
mod_phpor FPM design. - Only one PHP handler serves the site’s
.phprequests. - The FPM service, socket or TCP endpoint and Apache configuration use the same PHP version, when FPM is selected.
- WordPress meets the recommended PHP, database, HTTPS and rewrite prerequisites.
- Required PHP extensions load in the web SAPI.
wp-config.phphas valid database settings, and Apache/FPM can read the files.- Critical errors are traced in the WordPress email and
wp-content/debug.log. mod_rewriteis handled independently if only pretty permalinks fail.- The temporary
phpinfo.phpfile has been deleted.
Bottom line
Raw PHP after an Apache reinstall is a server-dispatch failure, not a WordPress template problem. Repair the active virtual host, restore one compatible PHP handler, verify it with a temporary phpinfo() page, and remove that page. When PHP executes normally, move on to WordPress’s version, extensions, database, permissions and logs; treat permalink 404s as a separate mod_rewrite issue.
Quick Recap
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.

