【应用服务 App Service】Azure App Service 中如何安装mcrypt - PHP

简介: 【应用服务 App Service】Azure App Service 中如何安装mcrypt - PHP

问题描述

Azure App Service (应用服务)如何安装PHP的扩展 mcrypt(mcrypt 是php里面重要的加密支持扩展库),同样改方法也适用于其他的扩展安装。在门户的配置项上添加PHP_EXTENSIONS,如有多个扩展使用逗号,分隔。

准备条件

  • 创建App Service, Runtime stack 选择为PHP,如图

 

注:选择Non Thread的原因是因为App Service的支持要求. https://docs.microsoft.com/en-us/azure/app-service/configure-language-php?pivots=platform-windows#enable-php-extensions

Enable PHP extensions

The best way to see the PHP version and the current php.ini configuration is to call phpinfo() in your app.

... ...

Add a bin directory to the root directory of your app and put the .dll extension files in it (for example, mongodb.dll). Make sure that the extensions are compatible with the PHP version in Azure and are VC9 and non-thread-safe (nts) compatible.

 

操作步骤

1)登录到Kudu站点,选择DebugConsole -> CMD。点击site和wwwroot文件夹后,进入wwwroot目录(两种方式登录Kudu。一:Azure App Service Overview -> Advanced Tools

-> Go。 二:在站点URL加上SCM访问。如:https://xxxxxx.scm.chinacloudsites.cn/)

2)在wwwroot目录中新建bin文件夹,并把php_mcrypt-1.0.3-7.2-nts-vc15-x86.zip压缩包中的内容解压后放入bin目录中(放入方式为 选中文件后直接拖拽到Kudu页面中bin文件夹区域

3)在wwwroot目录中新建info.php。文件内容包含phpinfo()函数的输出信息(点击文件夹旁边的加号创建新文件,然后点击文件左边的🖊按钮编辑文件内容

<?php
phpinfo();
phpinfo(INFO_MODULES);
?>


4)回到App Service 的配置页面 (Azure App Service Overview -> Configuration -> Application settings),添加参数PHP_EXTENSIONS,值为bin\php_mcrypt.dll

5)重启站点,访问info.php页面参看mcrypt插件信息,如:https://xxxxxx.chinacloudsites.cn/info.php

 

参考资料

Enable PHP extensionshttps://docs.microsoft.com/en-us/azure/app-service/configure-language-php?pivots=platform-windows#enable-php-extensions

 

mcrypt 1.0.3 for Windows : https://pecl.php.net/package/mcrypt/1.0.3/windows

相关文章
|
29天前
|
开发工具 git C++
【App Service】VS Code直接部署App Service时候遇见 “fatal: not a git repository (or any of the parent directories): .git”
通过VS Code发布Python App Service的时候,遇见了发布失败错误: The deployment failed with error: fatal: not a git repository (or any of the parent directories): .git . Please take a few minutes to help us improve the deployment experience
77 24
|
12天前
|
Java 程序员 PHP
01 入门PHP就来我这-安装phpstudy
路老师的PHP入门教程,带你从零开始学习PHP。首先下载并安装phpStudy,接着配置域名和端口,最后创建并运行第一个PHP文件。内容详实,适合初学者。
34 3
01 入门PHP就来我这-安装phpstudy
|
13天前
|
C# Windows
【Azure App Service】在App Service for Windows上验证能占用的内存最大值
根据以上测验,当使用App Service内存没有达到预期的值,且应用异常日志出现OutOfMemory时,就需要检查Platform的设置是否位64bit。
37 11
|
14天前
|
JavaScript C++ 容器
【Azure Bot Service】部署NodeJS ChatBot代码到App Service中无法自动启动
2024-11-12T12:22:40.366223350Z Error: Cannot find module 'dotenv' 2024-11-12T12:40:12.538120729Z Error: Cannot find module 'restify' 2024-11-12T12:48:13.348529900Z Error: Cannot find module 'lodash'
37 11
|
28天前
|
NoSQL MongoDB PHP
PHP7 MongDB 安装与使用
10月更文挑战第19天
33 1
PHP7 MongDB 安装与使用
|
12天前
|
开发框架 监控 .NET
【Azure App Service】部署在App Service上的.NET应用内存消耗不能超过2GB的情况分析
x64 dotnet runtime is not installed on the app service by default. Since we had the app service running in x64, it was proxying the request to a 32 bit dotnet process which was throwing an OutOfMemoryException with requests >100MB. It worked on the IaaS servers because we had the x64 runtime install
|
10天前
|
Java 开发工具 Windows
【Azure App Service】在App Service中调用Stroage SDK上传文件时遇见 System.OutOfMemoryException
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
|
11天前
|
安全 Apache 开发工具
【Azure App Service】在App Service上关于OpenSSH的CVE2024-6387漏洞解答
CVE2024-6387 是远程访问漏洞,攻击者通过不安全的OpenSSh版本可以进行远程代码执行。CVE-2024-6387漏洞攻击仅应用于OpenSSH服务器,而App Service Runtime中并未使用OpenSSH,不会被远程方式攻击,所以OpenSSH并不会对应用造成安全风险。同时,如果App Service的系统为Windows,不会受远程漏洞影响!
|
21天前
|
C#
【Azure App Service】使用Microsoft.Office.Interop.Word来操作Word文档,部署到App Service后报错COMException
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (0x80040154 (REGDB_E_CLASSNOTREG)).
|
22天前
【Azure App Service】PowerShell脚本批量添加IP地址到Web App允许访问IP列表中
Web App取消公网访问后,只允许特定IP能访问Web App。需要写一下段PowerShell脚本,批量添加IP到Web App的允许访问IP列表里!
下一篇
无影云桌面