简体   繁体   English

如何在PHP应用程序中使用加载程序脚本?

[英]How to use a loader script with PHP app?

So I have designed a PHP application that uses an oAuth2 API integration to create a unique interface for a CRM. 因此,我设计了一个PHP应用程序,该应用程序使用oAuth2 API集成来创建CRM的唯一接口。 App is working great on my server, and am ready to offer it to my clients. App在我的服务器上运行良好,随时可以将其提供给我的客户。

My initial idea for expanding this was to create a unique subdomain for each of them on my server, create a new database, and install my application onto that subdomain. 我最初的扩展想法是为服务器上的每个子域创建一个唯一的子域,创建一个新的数据库,然后将应用程序安装到该子域上。 My application only has one hard-coded file with the database login details, the rest is stored on a database. 我的应用程序只有一个带有数据库登录详细信息的硬编码文件,其余的存储在数据库中。

The problem I see with this is it is inefficient. 我看到的问题是效率低下。 I am essentially going be putting in the same files in many directories, which doesn't make a whole lot of sense. 实际上,我将把相同文件放在许多目录中,这没有任何意义。 Plus updating it would be annoying. 再加上更新将很烦人。

Since everything is being hosted by me, it was suggested that I create a core folder with all of the files. 由于所有内容都由我托管,因此建议我创建一个包含所有文件的核心文件夹。 Then I could use a loader script to read the database settings, and then use relative paths to access the core folder. 然后,我可以使用加载程序脚本读取数据库设置,然后使用相对路径访问核心文件夹。

My issue is how would this work? 我的问题是如何运作? Suppose my core domain is https://core.mydomain.com and my customer url is https://cus.mydomain.com . 假设我的核心域是https://core.mydomain.com,而我的客户网址是https://cus.mydomain.com Customer logins through their url. 客户通过其URL登录。 Now a customer wants to access https://cus.mydomain.com/person.php . 现在,客户希望访问https://cus.mydomain.com/person.php How would I make that work, considering that file is not located there (since it is in the core folder) ? 考虑到该文件不在此处(因为它位于核心文件夹中) ,我将如何工作? Would this require using custom htaccess? 这是否需要使用自定义htaccess?

If my current idea is wrong, what approach would you suggest? 如果我当前的想法是错误的,您会建议哪种方法? I am not married to this approach, and am looking for an efficient way of updating and managing the app. 我不喜欢这种方法,而是在寻找一种更新和管理应用程序的有效方法。 Thank you! 谢谢!

Use a symbolic link? 使用符号链接? https://en.wikipedia.org/wiki/Ln_(Unix) https://zh.wikipedia.org/wiki/Ln_(Unix)

You can create a folder with all your static files in /var/www/core/ and create a symbolic link in each customers folder. 您可以在/var/www/core/创建一个包含所有静态文件的文件夹,并在每个客户文件夹中创建一个符号链接。

ln -s /var/www/core /var/www/customer001/core/

this way all modifications in /var/www/core/ will be available to all customers 这样,/ var / www / core /中的所有修改将对所有客户可用

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

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