Browser Downloads PHP file instead of Displaying Web Page
This document (000021416) is provided subject to the disclaimer at the end of this document.
Environment
Apache Web Server (apache2)
PHP scripting language
Situation
- Visiting a php web page served by apache2 on SUSE Linux Enterprise Server
- Web browser downloads php file instead of displaying the page content
- php module(s) are not installed on the server. Check with this command (no results if not installed):
- rpm -qa | grep mod_php
- php module(s) are not enabled on the server. Check with these commands (no results if not enabled):
- a2enmod -l | grep php
- cat /etc/sysconfig/apache2 | grep php
Resolution
At command line if not installed:
- Run these commands:
- zypper install apache2-mod_php8 # Or other php flavor such as php81
- systemctl restart apache2
- Clear browser cache
At the command line if not enabled:
- Run this command:
- a2enmod php8 # Or other php flavor such as php81
- systemctl restart apache
- Clear browser cache
In YaST before running HTTP Wizard for the first time:
- Run these commands:
- zypper install yast2-http-server
- yast http-server # Or yast2 http-server if running in GUI
- Configure options as needed on Network Device Selection page
- Select Next
- Select Enable PHP Scripting on the Modules page
- Select Next
- Complete wizard configuring other options as needed
- Select Install at the prompt for installation of additional packages
In YaST after running HTTP Wizard for the first time:
- Run command: yast http-server # Or yast2 http-server if running in GUI
- Select Server Modules > php8 # Or other php flavor
- Select Toggle Status to change status to Enabled
- Select Finish
Cause
Additional Information
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:000021416
- Creation Date: 05-Apr-2024
- Modified Date:19-Apr-2024
-
- SUSE Linux Enterprise Server
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com