SUSE Support

Here When You Need Us

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

SUSE Linux Enterprise Server 15
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:

  1. Run these commands:
    • zypper install apache2-mod_php8    # Or other php flavor such as php81
    • systemctl restart apache2
  2. Clear browser cache

At the command line if not enabled:

  1. Run this command:
    • a2enmod php8   # Or other php flavor such as php81
    • systemctl restart apache
  2. Clear browser cache

In YaST before running HTTP Wizard for the first time:

  1. Run these commands: 
    • zypper install yast2-http-server
    • yast http-server    # Or yast2 http-server if running in GUI
  2. Configure options as needed on Network Device Selection page
  3. Select Next
  4. Select Enable PHP Scripting on the Modules page
  5. Select Next
  6. Complete wizard configuring other options as needed
  7. Select Install at the prompt for installation of additional packages

In YaST after running HTTP Wizard for the first time:

  1. Run command: yast http-server    # Or yast2 http-server if running in GUI
  2. Select Server Modules > php8   # Or other php flavor
  3. Select Toggle Status to change status to Enabled
  4. Select Finish

Cause

PHP module was not installed or not enabled in apache2.

Additional Information

For more information, see Apache HTTP Server Module Activation and Deactivation in the SUSE Documentation.

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

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.