简体   繁体   English

如何在 Azure 中启用 pdo_mysql?

[英]How to enable pdo_mysql in Azure?

I'm buildig a simple web application in Laravel 8 using PHP 7.4 and Azure web services. I'm buildig a simple web application in Laravel 8 using PHP 7.4 and Azure web services. The app runs perfectly on my local machine, but once I try to push my app to Azure I'm getting a PHP 500 error for all pages where some sort of querying is needed.该应用程序在我的本地计算机上完美运行,但是一旦我尝试将我的应用程序推送到 Azure,对于需要某种查询的所有页面,我都会收到 PHP 500 错误。

It turns out that I'm missing a pdo_mysql driver that hasn't been enabled when setting up our Linux server.事实证明,我在设置 Linux 服务器时缺少一个尚未启用的 pdo_mysql 驱动程序。 I've been looking through all the Azure documentation and I can't seem to find how to turn this pdo extension on.我一直在查看所有 Azure 文档,但似乎找不到如何打开这个 pdo 扩展。

Strange thing is Azure provides us two terminals: the SSH terminal and a Bash terminal (Kudo remote execution terminal).奇怪的是 Azure 为我们提供了两个终端:SSH 终端和 Bash 终端(Kudo 远程执行终端)。 When I run当我跑

php -m php-m

in the SSH, the pdo_mysql module does show up in the list.在 SSH 中,pdo_mysql 模块确实出现在列表中。 I can also migrate my tables within the SSH.我还可以在 SSH 中迁移我的表。 But once I run the same但是一旦我运行相同

php -m php-m

command in the Bash terminal, the module is not showing. Bash 终端中的命令,模块未显示。 Migrating tables in that terminal is also not possible, because it says I'm missing the pdo_mysql driver.在该终端中迁移表也是不可能的,因为它说我缺少 pdo_mysql 驱动程序。 The Oryxbuilder that builds my application after each git deployment also notices that I'm missing the pdo_mysql driver and returns the same error.在每次 git 部署之后构建我的应用程序的 Oryxbuilder 也注意到我缺少 pdo_mysql 驱动程序并返回相同的错误。

So how can I enable this module in Azure?那么如何在 Azure 中启用这个模块呢? Can anyone please help me?谁能帮帮我吗?

First of all i'd check to see if its enabled in the php.ini file, often located at /etc/php/{version}/cli/php.ini, cli may also be cgi or apache2 .首先,我会检查它是否在 php.ini 文件中启用,该文件通常位于 /etc/php/{version}/cli/php.ini,cli 也apache2cgicli

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

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