PHP-Azure mySQL应用内应用随机更改了端口 [英] PHP - Azure mySQL in-app Changed Ports Randomly

查看:65
本文介绍了PHP-Azure mySQL应用内应用随机更改了端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:我有一个运行在Azure Web App上且带有MySQL应用程序的PHP CMS.它已经运行了好几个月,突然开始出现SQL错误试图以一种受其访问权限禁止的方式访问套接字"我在CMS上挖了一下,然后比较了Azure提供的连接字符串并发现无缘无故知道Azure Azure应用内MySQL的端口已更改为新端口.快速更新它,现在可以正常工作.但是问题是,我不得不从抱怨它的客户那里找出困难的方法.

Background: I have a PHP CMS running on Azure Web App with MySQL in-app. It has been running fine for a few months, all of a sudden started getting SQL error "An attempt was made to access a socket in a way forbidden by its access permissions" I dug around the the CMS and compared the connection string provided by Azure and found out that the port for Azures In-App MySQL had changed to a new port for no reason i am aware of. Quickly updated it and it is working now. But the issue is, i had to find out the hard way from a customer complaining about it.

问题:为什么更改了端口,它将再次执行此操作?我如何阻止它将来更改或明确指定我希望它将来使用哪个端口?

Question: Why did the port change and will it do this again? How do i stop it from changing in the future or specify explicitly which port I want it to use going forward?

谢谢

推荐答案

@Suwatch已回答此问题

This question has been answered by @Suwatch here, which says:

VM可以托管多个WebApp;因此有多个应用内MySQL进程.当启动MySql进程时,我们尝试使用与以下端口相同的端口:前.但是,它可能被其他服务或其他应用程序所占用MySQL的.结果,端口可能会更改.此外,网络应用可以从一个虚拟机迁移到另一个虚拟机,可用端口集将是不同.

A VM can host multiple WebApps; hence multiple in-app MySQL processes. When we start MySql process, we attempt to use the same port as before. However, it may be taken by other service or other in-app MySQL. As a result, the port may change. In addition, web app can be moved from one VM to another and the set of available ports will be different.

为了编写稳定的客户端应用,请确保您已阅读来自env变量的连接信息.参见

In order to write the stable client app, do make sure you read the connection info from env variable. See this for more details.

这篇关于PHP-Azure mySQL应用内应用随机更改了端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆