Apache is downloading php files instead of displaying them

后端 未结 26 1717
陌清茗
陌清茗 2020-11-22 01:03

OS and server information:

  • CentOS 6.4 (Final)
  • Apache 2.2.15
  • PHP 5.5.1

I previously had php 5.3.x installed but decided to upgr

26条回答
  •  清歌不尽
    2020-11-22 01:36

    After struggling a lot I finally solved the problem.

    If you are prompted to download a .php file instead of executing it, then here is the perfect solution: I assume that you have installed PHP5 already and still getting this error.

    $ sudo su
    $ a2enmod php5
    

    This is it.

    But If you are still getting the error :

    Config file php5.conf not properly enabled: /etc/apache2/mods-enabled/php5.conf is a real file, not touching it
    

    then do the following:

    Turns out files shouldn't be stored in mods-enabled, but should rather be stored in mods-available. A symlink should then be created in mods-enabled pointing to the file stored in mods-available.

    First remove the original:

    $ mv /etc/apache2/mods-enabled/php5.conf /etc/apache2/mods-available/
    

    Then create the symbolic link:

    $ ln -s /etc/apache2/mods-available/php5.conf /etc/apache2/mods-enabled/php5.conf
    

    I hope your problem is solved.

提交回复
热议问题