PHP not interpreted, showing in view source

后端 未结 6 1980
春和景丽
春和景丽 2021-01-17 10:31

I\'m hoping that this will be a useful page for getting started running php code as well as solve the current problem I\'m having some very simple code as follows:



        
6条回答
  •  难免孤独
    2021-01-17 10:42

    If you have the contents of the web page in user directory like:

    /home/*/public_html
    

    Then you need to enable executing those, it's disabled by default:

    # Running PHP scripts in user directories is disabled by default
    # 
    # To re-enable PHP in user directories comment the following lines
    # (from  to .) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
    
        
            php_admin_flag engine Off
        
    
    

    Just comment out this piece of code located in the file:

    /etc/apache2/mods-enabled/php7.3.conf
    

    Adjust the path and file name to your system, PHP version, etc.

提交回复
热议问题