PHPMyAdmin showing code instead of webpage

shibumi1224
shibumi1224 used Ask the Experts™
on
I had installed PHPMyAdmin a few weeks ago on a Mac mini server running Lion Server. It was working fine before, but now when I try to go to server-name/phpmyadmin in a web browser, it shows the source code from the index.php file. I have tried restarting Apache, but it did not do anything.

I am using PHP 5.3.6 and Apache 2.2.20.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Garry GlendownConsulting and Network/Security Specialist
Commented:
Sounds like the PHP module isn't loaded ... check the config of Apache whether it's still in the list of active modules, and check the apache logs whether there are any errors shown ...

Author

Commented:
I know it was working before. I did not edit or change anything in the httpd.conf file. I wonder if it has anything to do with the my.cnf or the config.inc.php file? My apache error log shows


[notice] caught SIGTERM, shutting down
[warn] RSA server certificate CommonName (CN) 'my-server.local' does NOT match server name!?
httpd: Could not reliably determine the server's fully qualified domain name, using creative-server.local for ServerName
[notice Apache/2.2.20 (Unix) mod_ssl/2.2.20 OpenSSL/0.9.8r DAV/2 configured -- resuming normal operations


I also noticed some errors from last week, which occurred while I was on vacation. Looks like some hacking attempts:

[client 115.146.120.142] File does not exist: /Library/Server/Web/Data/Sites/Default/w00tw00t.at.blackhats.romanian.anti-sec:)
The server doesn't just forget how to run PHP, my guess is that it was compromised, and I'd strongly suggest reinstalling.

That being said, to get it working again in the mean time, you likely need to make sure two things are in place:
1)  That the PHP module is being loaded.  Look for something resembling the following in your config:
  LoadModule php5_module modules/libphp5.so
2)  That the file extension .php is known to the web server.  Look for these in your php.conf or httpd.conf:
  AddHandler php5-script .php
  AddType text/html .php

Keep in mind that both of these will need to be present for Apache to treat the file as PHP code rather than vanilla HTML.

CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

Author

Commented:
I found the line "#LoadModule php5_module libexec/apache2/libphp5.so" in my httpd.conf and uncommented it. My php5.conf had this in it:

<IfModule php5_module>
     AddType application/x-httpd-php .php
     AddType application/x-httpd-php-source .phps

     <IfModule dir_module>
          DirectoryIndex index.html index.php
     </IfModule>
</IfModule>

Where would I add in these two lines? In the httpd.conf file?
  AddHandler php5-script .php
  AddType text/html .php

Author

Commented:
I also found this in my httpd.conf


<IfModule php5_module>
     AddType application/x-httpd-php .php
     AddType application/x-httpd-php-source .phps

     <IfModule dir_module>
          DirectoryIndex index.html index.php
     </IfModule>
</IfModule>

Author

Commented:
Thanks, that worked. I just did not restart the apache server and cleared my browser cache!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial