- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我有 2 个 Laravel 应用程序在同一台服务器上运行。服务器是 Apache 2.4,我设置了虚拟主机来为不同域上的每个应用程序提供服务。
第一个应用程序是一个 API,它的 .env 文件设置如下:
APP_ENV=production
APP_KEY=YYYYYYYYYYYYYYYYYY
APP_DEBUG=false
APP_LOG_LEVEL=debug
APP_URL=https://notify.mysite.com
APP_DOMAIN=notify.mysite.com
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=notify
DB_USERNAME=YYYYYYYYYYYYYYYYYY
DB_PASSWORD=YYYYYYYYYYYYYYYYYY
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
第二个应用程序是一个 UI,它利用了第一个应用程序的 API。它的 .env 文件是这样设置的:
APP_ENV=local
APP_KEY=XXXXXXXXXXXXXX
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=https://asapps.mysite.com
APP_DOMAIN=asapps.mysite.com
APP_VERSION=1
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=asapps
DB_NOTIFY_DATABASE=notify
DB_FLIGHT_DATABASE=flights
DB_USERNAME=XXXXXXXXXXXXXX
DB_PASSWORD=XXXXXXXXXXXXXX
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
我可以从我的 Swagger 编辑器、Postman 和其他服务器向我的 API 发送消息,一切都按预期进行。
我的第二个应用程序本身也按预期工作。
但是,如果我的第二个应用程序向 API 发送请求,API 应用程序会抛出此错误:
exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'asapps.preprocessor_config' doesn't exist' in C:\notify\vendor\laravel\framework\src\Illuminate\Database\Connection.php:332
什么?
API 的数据库设置为 DB_DATABASE=notify,当我从其他服务器发送消息时,它肯定会正确使用该连接。那么为什么它要尝试使用第二个应用程序的数据库呢? 当我从那个应用程序调用 API 时连接???它几乎就像是在缓存数据库连接并尝试继续使用同一个连接....我该如何停止它?
Table 'asapps.preprocessor_config' doesn't exist'
最佳答案
经过更多挖掘(阅读疯狂的谷歌搜索),我找到了 problem and solution here
最重要的是,当站点 A 接受请求时,php 会在 http 请求的整个长度内加载它的 .env 变量。在该请求期间,当站点 A 调用站点 B 时,由于它们在运行相同 php 的同一台服务器上,php 仍在使用来自站点 A 的 .env 并且根本不单独加载站点 B 的 .env 文件。
作者更好的解释:
The .env file with the variables was created so that people would not push their credentials to github repositories and other places where they may share the source.
Now, being environment variables they become system wide for the entire duration of the http request (in this case script execution). The point is that you got a long running script.
To find a definitive solution you could go one of the three ways.
....
'namespace' the ENV variables.
关于php - 同一台服务器上的两个 Laravel 应用程序相互冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42075542/
这个问题已经有答案了: Resolve build errors due to circular dependency amongst classes (12 个回答) 已关闭 3 个月前。 如何允许
让 2 个 Swing 部件做同样的工作是很常见的。例如,我们可以在工具栏中使用一个 button 作为“保存”按钮,而 JMenuItem (文件保存...)也可以做同样的事情。 我的问题是: 有没
我使用 fragment 已经有一段时间了,但我经常遇到一个让我烦恼的问题。 fragment 有时会相互吸引。现在,我设法为此隔离了一个用例,它是这样的: Add fragment A(也使用 ad
我正在使用具有相互 SSL 安全性的 WCF 服务,我想检查一下我对何时使用什么证书的理解。 这是正确的吗? 客户端将客户端公共(public)证书交给服务器 服务器将服务器公共(public)证书交
假设您有一个相互 SSL 服务,除了 SSL 之外,它还有应用程序身份验证。因此,客户端提供证书(以及服务器),但客户端请求(例如 REST 请求)还包含后端应用程序服务器用于验证的用户名/密码。 就
有人让 Android uiautomator 可以同时在多个设备上运行,但做不同的事情吗? 我的意思是,我希望我的测试同时启动设备和应用程序,然后设备 A 执行设备 B 必须使用react的操作。这
我目前正在尝试在客户端和服务器之间实现双向 TLS 身份验证。我遇到了一个 SSL 错误,它的描述性不强。 StackOverflow 也没有太多与之相关的问题,因为大多数时候它是互联网上的单向 TL
这里是新手。我正在做我的第一个元素,我想为不同的人(普通人、 worker 、农民等)提供 slider ,但我不知道如何放置多个 slider 以及如何让它们全部工作。我从 W3schools 获取
我创建了一张翻转卡片,但卡片内的所有 div 似乎都浮在彼此之上。我希望 div 彼此相邻。 我看了很多问题,但似乎找不到答案。我尝试了多种显示:内联;职位:相对;向左飘浮;清除:两者;但我似乎无法让
我正在使用此控件来安排时间。我有一个单选按钮列表,然后是多个内容 Pane 。根据内容,我想在正确的控件中淡入淡出。但出于某种原因,在 div 上放置一个 float 并设置 z-index 并不能使
有什么方法可以解密双向 SSL(客户端和服务器,两种方式)? 我找到了这个链接:https://www.wireshark.org/lists/wireshark-users/201001/msg00
我正在开发一个 Web 应用程序,安全性是我们在此应用程序中的主要关注点之一。我正在查看不同的 API 安全方法(在 OWASP 中提到),无法理解相互 SSL 身份验证和基于 token 的身份验证
我正在尝试使用分配给 kube-dns 服务的集群 IP 从 dnstools pod ping kube-dns 服务。 ping 请求超时。在同一个 dnstools pod 中,我尝试使用暴露的
过去几天我一直在研究这个问题,但我一无所获。 场景是: 现场的 iOS 应用程序将调用我的 REST 服务 (.NET)。我的 REST 服务将使用相互 SSL 握手调用 Apache Web 服务。
我正在尝试向 java swing 应用程序添加 3 个 JSlider,以便三个 slider 的总值(value)总和为 100。每个 slider 都是一个概率, slider A 是将值添加到
我们正在使用 java 客户端(openJDK 1.8.0) 调用需要相互身份验证的 api。为此,我们使用 Java 标准 JKS 文件作为 keystore 和信任库(包含信任证书和身份证书/私钥
有人告诉我使用双向身份验证连接到客户的服务器。服务器身份验证工作顺利,但我们在获取客户端身份验证方面遇到了巨大的麻烦。让我试着解释一下我们的麻烦。 前段时间我公司在 GeoTrust 购买了一个证书,
正在试用 PAW 并且非常喜欢它。我唯一无法正常工作的是使用 HTTPS 相互身份验证。我需要与之交互的一些 API 需要相互验证的 https。 如何告诉 PAW 使用证书进行身份验证?该证书已经在
我们有一个在 Jboss EAP 5.1 中部署并使用 Spring 2.5 已经运行了一年多的 CXF webservice 我们现有的客户证书管理策略如下: 对于非 PROD,证书名为“NAME-
我正在创建一个将调用 API 的 Windows 服务。对于这个过程,我正在尝试建立相互(双向)SSL 身份验证。因为我是新手。我尝试实现一个简单的客户端和服务器项目,它们将相互进行身份验证。 我已经
我是一名优秀的程序员,十分优秀!