Home > Article > Backend Development > Why is My PHP Code Showing as Plain Text in the Browser?
Understanding PHP Plain Text Display Issue
You've encountered an issue where your PHP files are showing as plain text in your browser, despite their PHP code. To resolve this, we need to investigate the underlying cause.
PHP and Apache Configuration
When you install PHP separately from Apache, you need to explicitly configure Apache to use the PHP module. This is essential for Apache to recognize and execute PHP files.
Installation of PHP Module for Apache
To resolve the issue, you need to install the PHP module for Apache. The specific instructions depend on your operating system:
Debian and Ubuntu:
Restarting Apache
After installing the PHP module, you need to restart Apache to apply the changes. This is done with the following command:
Verification
Once Apache has restarted, you should be able to access PHP files correctly. Navigate to your 'test.php' file in the browser and verify that it displays the PHP information.
The above is the detailed content of Why is My PHP Code Showing as Plain Text in the Browser?. For more information, please follow other related articles on the PHP Chinese website!