【发布时间】:2021-05-07 04:15:10
【问题描述】:
我用 php 7.4 更新了我的服务器,但它产生了一些问题,我的网站无法再次运行,问题在重新安装 httpd 或安装 httpd-devel 后开始不确定 我有 bitrix 管理我的网站,但是该应用程序也托管在服务器上,并且每当我尝试访问它时都不会部署它,它会下载 php 文件,我至少需要它才能再次运行
环境:
Centos 7
PHP7.4
httpd -v : 服务器版本:Apache/2.4.6 (CentOS)
nginx -v : nginx 版本:nginx/1.16.1
我尝试使用“AddType”和“AddHandler”但没有机会
我尝试删除 htaccess 并重新创建相同的问题
我找不到 LoadModule php so 模块,即使在模块文件中,所以我没有尝试过该选项或者我不知道从哪里开始
我的一个网站的 conf 文件示例:
# Ansible managed
# site: medrec.org
<VirtualHost 127.0.0.1:8887>
ServerName medrec.org
ServerAlias www.medrec.org
ServerAdmin webmaster@localhost
DocumentRoot /home/bitrix/ext_www/medrec.org/public
ErrorLog logs/medrec_error_log
LogLevel warn
CustomLog logs/medrec_access_log combined
<IfModule mod_rewrite.c>
#Nginx should have "proxy_set_header HTTPS YES;" in location
RewriteEngine On
RewriteCond %{HTTP:HTTPS} =YES
RewriteRule .* - [E=HTTPS:on,L]
</IfModule>
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<DirectoryMatch .*\.svn/.*>
Require all denied
</DirectoryMatch>
<DirectoryMatch .*\.git/.*>
Require all denied
</DirectoryMatch>
<DirectoryMatch .*\.hg/.*>
Require all denied
</DirectoryMatch>
<Directory /home/bitrix/ext_www/medrec.org/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
DirectoryIndex index.php index.html index.htm
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Require all granted
#php_admin_value session.save_path /tmp/php_sessions/ext_www/medrec.org
#php_admin_value upload_tmp_dir /tmp/php_upload/ext_www/medrec.org
</Directory>
<Directory /home/bitrix/ext_www/medrec.org/bitrix/cache>
AllowOverride none
Require all denied
</Directory>
<Directory /home/bitrix/ext_www/medrec.org/bitrix/managed_cache>
AllowOverride none
Require all denied
</Directory>
<Directory /home/bitrix/ext_www/medrec.org/bitrix/local_cache>
AllowOverride none
Require all denied
</Directory>
<Directory /home/bitrix/ext_www/medrec.org/bitrix/stack_cache>
AllowOverride none
Require all denied
</Directory>
<Directory /home/bitrix/ext_www/medrec.org/upload>
AllowOverride none
#AddType text/plain php,php3,php4,php5,php6,phtml,pl,asp,aspx,cgi,dll,exe,ico,shtm,shtml,fcg,fcgi,fpl,asmx,pht
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#php_value engine off
</Directory>
<Directory /home/bitrix/ext_www/medrec.org/upload/support/not_image>
AllowOverride none
Require all denied
</Directory>
<Directory /home/bitrix/ext_www/medrec.org/bitrix/images>
AllowOverride none
#AddType text/plain php,php3,php4,php5,php6,phtml,pl,asp,aspx,cgi,dll,exe,ico,shtm,shtml,fcg,fcgi,fpl,asmx,pht
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
#php_value engine off
</Directory>
<Directory /home/bitrix/ext_www/medrec.org/bitrix/tmp>
AllowOverride none
AddType text/plain php,php3,php4,php5,php6,phtml,pl,asp,aspx,cgi,dll,exe,ico,shtm,shtml,fcg,fcgi,fpl,asmx,pht
#php_value engine off
</Directory>
</VirtualHost>
httpd.conf
ServerTokens OS
ServerRoot "/etc/httpd"
PidFile run/httpd.pid
# Timeout: The number of seconds before receives and sends time out.
Timeout 120
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
KeepAlive Off
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
MaxKeepAliveRequests 100
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
KeepAliveTimeout 15
<IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
# Active module
Include conf.modules.d/*.conf
<IfModule setenvif_module>
SetEnvIf X-Forwarded-Scheme https HTTPS=on
SetEnvIf X-Forwarded-Proto https HTTPS=on
</IfModule>
#
# Disabled standart config
#
#Include conf.d/*.conf
#
# BitrixEnv include configs
#
Include bx/conf/*.conf
Include bx/custom/*.conf
User bitrix
Group bitrix
ServerAdmin root@localhost
UseCanonicalName Off
DocumentRoot "/home/bitrix/www"
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<IfModule mod_userdir.c>
UserDir disable
</IfModule>
DirectoryIndex index.html
AccessFileName .htaccess
<Files ~ "^\.ht">
Require all denied
</Files>
TypesConfig /etc/mime.types
#ForceType text/plain
<IfModule mod_mime_magic.c>
MIMEMagicFile conf/magic
</IfModule>
HostnameLookups Off
ErrorLog logs/error_log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog logs/access_log combined
ServerSignature On
<IfModule mod_dav_fs.c>
# Location of the WebDAV lock database.
DAVLockDB /var/lib/dav/lockdb
</IfModule>
<IfModule mod_autoindex.c>
IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable
IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t
</IfModule>
AddLanguage ca .ca
(Laguages ...)
#LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW
#ForceLanguagePriority Prefer Fallback
AddDefaultCharset UTF-8
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddHandler type-map var
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
#BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
#BrowserMatch "MS FrontPage" redirect-carefully
#BrowserMatch "^WebDrive" redirect-carefully
#BrowserMatch "^WebDAVFS/1.[0123]" redirect-carefully
#BrowserMatch "^gnome-vfs/1.0" redirect-carefully
#BrowserMatch "^XML Spy" redirect-carefully
#BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
更新 conf.modules.d 中的配置列表
15-php.conf
模块
【问题讨论】:
-
您是在运行 Apache 还是 Nginx 作为您的 Web 服务器?
-
@RamanSailopal 我正在运行 nginx,没有 apache2 或 php-fpm 服务,我使用的是 httpd (apachectl)
-
这没有意义。你说你用httpd运行Nginx?是一个还是另一个?
-
是的,两个服务都应该启动,如果我停止其中一个,它根本不会运行
-
我的猜测是,在文件夹
conf.modules.d中有一个 php 文件,其中包含与LoadModule php_module /usr/lib/apache2/modules/libphp8.0.so类似的内容,其中 php_module 现在可能需要为 php7_module,so 文件将被称为不同