F
F
FMars2016-03-21 03:18:24
PHP
FMars, 2016-03-21 03:18:24

Why PHP code is output just as text?

I decided to upgrade to version 7 of PHP. Followed this instruction.
After installation the terminal says php7 is installed:
44b444f5e47a4a0192d3a277cc795d09.png
but here is when I wanted to check the version on the server:

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
phpinfo();

php-code was displayed to me as plain text in the browser:
d19fdeb655604f5eb643ddf8ba8d9237.png
What could be the problem?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
Z
Zakaz_zakaz, 2016-03-21
@Zakaz_zakaz

– The server configuration does not specify that .php files should be executed as PHP code.
– PHP library not installed

A
Andrzej Wielski, 2016-03-21
@wielski

You may be using nginx on your server.
In this case, php must be installed as php-fpm, specifying the version in the configs.

O
OnYourLips, 2016-03-21
@OnYourLips

You most likely do not have php-fpm installed (for php7, the package may be called php7.0-fpm).
Or its use is not configured in the web server.
I advise you to use nginx, not apache: it is not only more productive, but also easier to configure.

V
Viktor Taran, 2016-03-21
@shambler81

Make sure you don't have anything like that in your configs or .htaccess
or

<IfModule mod_mime.c>
        <Files ~ \.(php|php3|php4|php5|php6|phtml|pl|asp|aspx|cgi|dll|exe|shtm|shtml|fcg|fcgi|fpl|asmx|pht|py|psp|rb|var)>
                SetHandler text/plain
                ForceType text/plain
        </Files>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question