/ PHP Displaying Blank Page on Apache - rtt - IT Resource

PHP Displaying Blank Page on Apache

Almost always the reason will be that the php.so file is missing but also that php.conf is misconfigured.

In the problem machine it is actually PHP 7 installed so if you reference PHP 5 of course things wil be broken!

Take for example here:

cat /etc/httpd/conf.d/php.conf
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#

LoadModule php7_module modules/libphp7.so

#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php7-script .php
AddType text/html .php

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps

 

moodle displays code instead of outputting HTML

cat /etc/httpd/conf.d/php.conf|grep -i addhandler
AddHandler php5-script .php
 

Fix it and then restart Apache


sed -i s/"php5-script"/"php7-script"/g /etc/httpd/conf.d/php.conf
service httpd restart


 


 


Tags:

php, displaying, apachealmost, conf, misconfigured, installed, reference, wil, etc, httpd, html, embedded, scripting, attempts, developers, dynamically, generated, webpages, loadmodule, _module, modules, libphp, interpreter, extension, addhandler, addtype, text, index, directory, indexes, directoryindex, uncomment, phps, moodle, displays, outputting, grep, restart, apache, sed, quot,

Latest Articles

  • How Does Cisco CUCM (Cisco Unified Communication Manager) Work?
  • What DNS Options Does Active Directory Offer in Windows Server 2008,2012,2016 ?
  • syntax error, unexpected T_SL in PHP Solution
  • grep regular expression match number range between specific numbers
  • bash how to print out lines of text within a range from the first occurrence
  • bash script how to to check LAN computers for open ports
  • MySQL Using mytop Debug Source of High IO and Slow Performance
  • How To Mathematically Convert and Calculate Binary Value To Decimal Value
  • systemd management using systemctl and journalctl to check systemd logs
  • css how to format code in the code tag
  • css br with extra blank line
  • What is /dev/pts and why do we need it in Linux?
  • Linux What is umask (user mask) for file and directory creation permissions and how to calculate umask and change the defaults
  • Linux Permissions and Groups Real Usecase for Group Access
  • Centos 7 python34 how to install the gi library
  • Centos 7 - Convert Minimal to Graphical GUI GNOME or KDE Desktop
  • AMD Set Fan Speed and Other Powerplay Memory/CPU Timings with a Linux script
  • Ethereum Mining Claymore Nanopool Error
  • genisoimage errors with long filenames and deep directory structures
  • Linux Kernel USB Export Errors