php7 - Under ubuntu16, Apache2 parses php and displays source code
为情所困
为情所困 2017-05-16 16:58:55
0
1
969

On ubuntu, apache can only display the source code when parsing php
When accessing http://localhost/, it shows that it works!

Then I wrote a phpinfo.php and placed it in /var/www/html. The code is:

<?php
        echo phpinfo();
?>

Then I tried to access it

Then I tried to modify the php configuration file, but I couldn't find this file. There was only one conf.d file under /etc/php/7.0/apache2/, and there was no php.ini file in it, so I just Even more puzzled.
Finally I changed the code of phpinfo.php:

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
<?php
        echo phpinfo();
?>

</body>
</html>

At this time, what is parsed is a blank page

So, how can we solve the problem of parsing php like this and only displaying the source code?

为情所困
为情所困

reply all(1)
滿天的星座

$$ a2dismod mpm_event && a2enmod mpm_prefork && a2enmod php7.0

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template