Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

phpmyadmin displays code not web page

I was upgrading my distro, from kali(wheezy) to sid. But when I was setting up my web server, I reinstalled all over, apache2, php, mysql etc., but I get this error when I access localhost/phpmyadmin: that URL is not showing an index / login page of phpmyadmin, but showing the code. In my /var/www the default is index.html, I renamed it to index.php, and it's ok, page is loaded, I do the same with my other directory in /var/www I added index.php or foo.php and access it, no problem, but when I enter phpmyadmin it's showing code. I tried installing phpminiadmin and adminer, but I get the same error, both are showing the code and not the web page.

Here is my apache2.conf http://pastebin.com/MLYNQc6S

And here is my spec :

#php -v
PHP 5.5.7-2 (cli) (built: Dec 13 2013 00:25:07) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans



# mysql --version
mysql  Ver 14.14 Distrib 5.5.33, for debian-linux-gnu (i686) using readline 6.2


# apache2 -v
Server version: Apache/2.4.6 (Debian)
Server built:   Aug 12 2013 18:20:23


uname -a
Linux angga.id 3.7-trunk-686-pae #1 SMP Debian 3.7.2-0+kali8 i686 GNU/Linux

and no error found in my /var/log/apache2/*log

I found this Localhost/phpmyadmin/ returns php code but didnt help.

so whats wrong with my server ?

EDIT 1 : Like @Matt said in first comment. libapache2-mod-php5 is not installed, so I installing it with apt-get from repo.

apt-get install libapache2-mod-php5

but its return an error, like this.

dpkg: error processing libapache2-mod-php5 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 libapache2-mod-php5
E: Sub-process /usr/bin/dpkg returned an error code (1)

I open synaptic and search for libapache2-mod-php5 there are showing two package with that name libapache2-mod-php5filter and libapache2-mod-php5 , I check it all, and install it, success, no error found, i restart apache2 and go to localhost/phpmyadmin and its work. thanks for matt.

like image 206
3118731 Avatar asked Dec 23 '13 08:12

3118731


Video Answer


2 Answers

Try this

sudo apt-get install libapache2-mod-php7.0

This installs the library for apache2 to use php7.0

like image 199
The Farmer Avatar answered Oct 18 '22 08:10

The Farmer


please check below things, have found for you from some diff links:

 1. Make sure that PHP is installed. This sounds silly, but you never   
    know.

 2. Make sure that the PHP module is listed and uncommented inside of your Apache's httpd.conf This should be something like
    LoadModule    php5_module "c:/php/php5apache2_2.dll" in the file.
    Search for    LoadModule php, and make sure that there is no comment
    (;) in front    of it.

 3. Make sure that the http.conf file has the PHP MIME type in it. This should be something like AddType application/x-httpd-php
    .php.    This tells Apache to run .php files as PHP. Search for
    AddType, and    then make sure there is an entry for PHP, and that
    it is uncommented.

 4. Make sure your file has the .php extension on it, otherwise it will not be executed as PHP.

 5. Make sure you are not using short tags in the PHP file (<?), these are deprecated, and usually disabled. Use <?php instead.
           Actually run your file over said webserver using an URL like http://localhost/file.php not via local access   
    file://localhost/www/file.php

Or check http://php.net/install

thanks

like image 38
Krunal Shah Avatar answered Oct 18 '22 09:10

Krunal Shah