我在 xampp 上本地运行了两个不同的 laravel 应用程序。我注意到,如果一个应用程序对第二个应用程序进行 API 调用,则后者使用第一个应用程序的数据库连接而不是它自己的数据库连接。第二个应用程序没有引导还是它的连接被覆盖了?有没有人经历过这个?
错误
Exception has occurred.PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'front.application_users' doesn't exist
所以实际上发生的是'front'前缀是第一个进行api调用的应用程序数据库名称,'application_users'是来自第二个应用程序的表。
我正在使用虚拟主机,并且应用程序位于不同的地址下。
<VirtualHost 127.0.0.2:80>
DocumentRoot "D:/projects/piaservice/admin/public"
ServerName admin.pia
ServerAlias admin.pia
<Directory "D:/projects/piaservice/admin/public">
Options All
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
Allow from all
ReWriteEngine On
</Directory>
</VirtualHost>
<VirtualHost 127.0.0.3:80>
DocumentRoot 'D:/projects/piaservice/frontend/public'
ServerName front.pia
ServerAlias front.pia
<Directory "D:/projects/piaservice/frontend/public">
Options All
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
Allow from all
ReWriteEngine On
</Directory>
</VirtualHost>