简体   繁体   English

为什么我们的 Nginx web 服务器上的子域不加载或不支持 PHP-MySQL 文件?

[英]Why the subdomains on our Nginx web server do not load or support PHP-MySQL file?

When we do a当我们做一个

php -v php -v

command, we see PHP installed on our Ubuntu 18.04 LTS system:命令,我们看到 PHP 安装在我们的 Ubuntu 18.04 LTS 系统上:

~# php -v
PHP 7.4.26 (cli) (built: Nov 22 2021 09:47:55) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.26, Copyright (c), by Zend Technologies

Same for MySQL: MySQL 相同:

~# mysql -V
mysql  Ver 8.0.27 for Linux on x86_64 (MySQL Community Server - GPL).

The problem is when we run the "index.php" file from our "app.example.com/index.php" subdomain, it downloads through our web browser a file named "Download".问题是当我们从“app.example.com/index.php”子域运行“index.php”文件时,它会通过我们的 web 浏览器下载一个名为“Download”的文件。 This file is even considered a virus by the browser in question.该文件甚至被相关浏览器视为病毒。 Only HTML file works well with the same "app.example.com/index.html" subdomain.只有 HTML 文件适用于相同的“app.example.com/index.html”子域。 However when we check if php is well installed and even its version, this is confirmed but the subdomains do not take into account or do not load PHP-MySQL Codes at all.然而,当我们检查 php 是否安装良好,甚至它的版本时,这得到了证实,但子域没有考虑或根本不加载 PHP-MySQL 代码。

We specify that we are under the " Nginx " Web Server.我们指定我们在“ Nginx ”Web服务器下。

So, why are we confronted with this problem which makes that the subdomain does not support PHP-MySQL and returns the download in the web browser of our files while PHP and MySQL are indeed installed on the hostname of the Nginx Web Server??? So, why are we confronted with this problem which makes that the subdomain does not support PHP-MySQL and returns the download in the web browser of our files while PHP and MySQL are indeed installed on the hostname of the Nginx Web Server???

Thank you for helping us please.谢谢你帮助我们。

If you use nginx you probably want to use php-fpm.如果您使用 nginx,您可能想要使用 php-fpm。 This must of course be included in the corresponding nginx configuration (probably explicitly for each host that should be able to use PHP).这当然必须包含在相应的 nginx 配置中(可能明确地针对应该能够使用 PHP 的每个主机)。 Here is a guide that describes what I mean: https://www.howtoforge.com/tutorial/how-to-install-nginx-with-php-and-mysql-lemp-on-ubuntu-1804/#step-configure-nginx-and-phpfpm这是描述我的意思的指南: https://www.howtoforge.com/tutorial/how-to-install-nginx-with-php-and-mysql-lemp-on-ubuntu-1804/#step-configure -nginx-和-phpfpm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM