Apache is downloading php files instead of displaying them

后端 未结 26 1102
陌清茗
陌清茗 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:43

    After updating PHP to 7.3, PHP scripts where run with www-data instead of $USER like before.

    I needed to reinstall and activate PHP-FPM :

    sudo apt-get install php-fpm
    sudo a2enmod proxy_fcgi setenvif
    sudo service apache2 restart
    sudo a2enconf php7.3-fpm
    sudo service apache2 restart
    

    To ensure everything was ok for Virtualmin, i used the Re-Check Configuration wizard /virtual-server/check.cgi, under Vitualmin/System Settings.

    After that, Apache/PHP was downloading php files instead of running them. So i needed to edit /etc/apache2/mods-available/php7.3.conf to comment the row SetHandler application/x-httpd-php like below :

    
    #    SetHandler application/x-httpd-php
    
    

    After restarting Apache, it solved my issue, hope this help.

    Take care of browser cache too.

    My system :

    Ubuntu          16.04.6 LTS
    Webmin version      1.932
    Usermin version     1.780
    Virtualmin version  6.08
    Apache version      2.4.41
    PHP versions        7.3.12
    PHP-FPM         7.3.12 Server
    

提交回复
热议问题