Answer the question
In order to leave comments, you need to log in
Why is it displayed as php text?
Hello, please tell me, I am transferring the site to MODX from one VDS to another. I create a virtual host file:
/etc/apache2/sites-available/plitka.conf
, with the following content:
<VirtualHost 77.222.55.203:80 [2a02:408:7722:54:77:222:55:203]:80>
ServerName plitka-ykt.ru
ServerAlias www.plitka-ykt.ru
DocumentRoot /var/www/www-root/data/plitka-ykt.ru
ServerAdmin [email protected]
DirectoryIndex index.php index.html
AddDefaultCharset off
#AssignUserID www-root www-root
CustomLog /var/www/httpd-logs/plitka-ykt.ru.access.log combined
ErrorLog /var/www/httpd-logs/plitka-ykt.ru.error.log
<FilesMatch "\.ph(p[3-5]?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
<IfModule php5_module>
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f [email protected]"
php_admin_value upload_tmp_dir "/var/www/www-root/data/mod-tmp"
php_admin_value session.save_path "/var/www/www-root/data/mod-tmp"
php_admin_value open_basedir "/var/www/www-root/data:."
</IfModule>
<IfModule php7_module>
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f [email protected]"
php_admin_value upload_tmp_dir "/var/www/www-root/data/mod-tmp"
php_admin_value session.save_path "/var/www/www-root/data/mod-tmp"
php_admin_value open_basedir "/var/www/www-root/data:."
</IfModule>
</VirtualHost>
<Directory /var/www/www-root/data/shina-belgorod.ru>
Options +Includes -ExecCGI
<IfModule php5_module>
php_admin_flag engine on
</IfModule>
<IfModule php7_module>
php_admin_flag engine on
</IfModule>
</Directory>
sudo a2ensite modx.conf
sudo a2enmod rewrite
sudo systemctl reload apache2
sudo certbot-auto --apache -d plitka-ykt.ru
Answer the question
In order to leave comments, you need to log in
Попробуем угадать:
short_open_tag не включен. Нужно писать в начале php-файла "<?php" вместо "<?".
Ну, из очевидного: нужно проверить модуль php у апача:
apache2ctl -M
Вот так можно сделать то что у тебя сейчас.
Ну или не объявить их вообще.
<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>
</IfModule>
<IfModule mod_php5.c>
php_flag engine off
</IfModule>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question