2013-12-23 107 views
3

我正在升級我的發行版,從kali(wheezy)到sid。但是當我建立我的web服務器時,我重新安裝了所有的,apache2,php,mysql等,但是當我訪問localhost/phpmyadmin時出現此錯誤:該URL沒有顯示phpmyadmin的索引/登錄頁面,但顯示了代碼。在我的/var/www默認是index.html,我把它重新命名爲index.php,沒關係,頁面加載後,我在/var/www/var/www中執行同樣的操作我添加了index.php或foo.php並訪問它,no問題,但是當我輸入phpmyadmin它顯示代碼。我嘗試安裝phpminiadminadminer,但我得到相同的錯誤,都顯示代碼而不是網頁。phpmyadmin顯示代碼不是網頁

這裏是我的apache2.conf http://pastebin.com/MLYNQc6S

這裏是我的規格:

#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 

,並沒有在my /var/log/apache2/*log

發現錯誤,我發現這個Localhost/phpmyadmin/ returns php code但沒有幫助。

所以我的服務器怎麼了?編輯1: 像@Matt在第一評論中說。 libapache2-mod-php5沒有安裝,所以我從回購安裝apt-get

apt-get install libapache2-mod-php5 

但它返回一個錯誤,像這樣。

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) 

我打開突觸和搜索libapache2-mod-php5有顯示兩個包使用該名稱libapache2-mod-php5filterlibapache2-mod-php5,我檢查了這一切,並安裝它,成功,沒有發現錯誤, 我重新啓動的Apache2和去localhost/phpmyadmin和是工作。 謝謝亞光。

+0

我不相信這個問題是最好的問題Stack Overflow;這與服務器管理有關,而不是編程。也許嘗試[超級用戶](http://superuser.com)? (這看起來可能是一個非常簡單的配置錯誤,我猜測你只是沒有在Apache中加載PHP模塊。鑑於[wiki中的說明](https://wiki.debian.org/ LaMp#Test_PHP)我可能會確保你安裝了'libapache2-mod-php5',但我不是Debian的專家。) –

+0

@MattGibson你沒錯,'libapache2-mod-php5'沒有安裝,但是我安裝錯誤dpkg:錯誤處理libapache2-mod-php5(--configure): 子進程安裝後安裝腳本返回錯誤退出狀態1 處理時遇到錯誤: libapache2-mod-php5 E:進程/ usr/bin/dpkg返回錯誤代碼(1)'。我將首先修復此安裝錯誤,並在完成時測試以訪問'phpmyadmin' :)感謝您的幫助:) – 3118731

回答

7

請檢查下面的事情,已經找到了你的一些差異鏈接:

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 

或檢查http://php.net/install

感謝

2

試試這個命令和apt-get安裝中的libapache2-MOD-PHP7。 0

+0

提供更多解釋安裝此操作的原因是什麼? –