Answer the question
In order to leave comments, you need to log in
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:
but here is when I wanted to check the version on the server:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
phpinfo();
Answer the question
In order to leave comments, you need to log in
– The server configuration does not specify that .php files should be executed as PHP code.
– PHP library not installed
You may be using nginx on your server.
In this case, php must be installed as php-fpm, specifying the version in the configs.
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.
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 questionAsk a Question
731 491 924 answers to any question