CN113157332A - PHP dynamic configuration automatic validation method and system - Google Patents

PHP dynamic configuration automatic validation method and system Download PDF

Info

Publication number
CN113157332A
CN113157332A CN202110315593.0A CN202110315593A CN113157332A CN 113157332 A CN113157332 A CN 113157332A CN 202110315593 A CN202110315593 A CN 202110315593A CN 113157332 A CN113157332 A CN 113157332A
Authority
CN
China
Prior art keywords
php
configuration
configuration parameters
center
parameters
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110315593.0A
Other languages
Chinese (zh)
Inventor
郑韩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Yishi Huolala Technology Co Ltd
Original Assignee
Shenzhen Yishi Huolala Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Yishi Huolala Technology Co Ltd filed Critical Shenzhen Yishi Huolala Technology Co Ltd
Priority to CN202110315593.0A priority Critical patent/CN113157332A/en
Publication of CN113157332A publication Critical patent/CN113157332A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application is applicable to the field of computers, and provides a PHP dynamic configuration automatic validation method and a system, wherein the method comprises the following steps: the configuration center receives and stores PHP configuration parameters set by a user; monitoring the change of PHP configuration parameters of a configuration center by an agent service module of the server, acquiring updated PHP configuration parameters from the configuration center when the change of the PHP configuration parameters of the configuration center is found, and storing the PHP configuration parameters into a PHP configuration file of an appointed storage directory; and the PHP application program installed in the server reads the PHP configuration file from the specified directory. The automatic PHP dynamic configuration effect method is efficient, convenient and high in safety.

Description

PHP dynamic configuration automatic validation method and system
Technical Field
The application belongs to the field of computers, and particularly relates to a PHP dynamic configuration automatic validation method and system.
Background
PHP (Hypertext Preprocessor) is a scripting language executed on the server side, particularly suitable for Web development and embeddable in HTML. In the process of developing a PHP application, it is often necessary to configure parameters, such as configuring a server address and an account password of a connection database, configuring a domain name of a dependent application, and the like.
One of the current mainstream PHP configurations is: the method comprises the steps of configuring parameters through environment variables, specifically writing the parameters needed by the PHP into the environment variables of a server where a PHP application program is located, obtaining the environment variables of a local machine through a specific function when the codes of the PHP application program need to use the configuration parameters, and then continuously operating the service logic of the codes according to the parameters. However, when the PHP application deploys a large number of nodes, one PHP application needs to modify the environment variables, which is prone to cause problems of low efficiency and high error probability.
Disclosure of Invention
The application aims to provide a method and a system for automatic validation of PHP dynamic configuration, and aims to solve the problems that when more nodes are deployed in a PHP application program, the environmental variables are modified by one device, so that the efficiency is low and errors are easy to occur.
In a first aspect, the present application provides a PHP dynamic configuration automatic validation method, including:
the configuration center receives and stores PHP configuration parameters set by a user;
monitoring the change of PHP configuration parameters of a configuration center by an agent service module of the server, acquiring updated PHP configuration parameters from the configuration center when the change of the PHP configuration parameters of the configuration center is found, and storing the PHP configuration parameters into a PHP configuration file of an appointed storage directory;
and the PHP application program installed in the server reads the PHP configuration file from the specified directory.
In a second aspect, the present application provides a PHP dynamic configuration automation efficiency system, comprising a configuration center and a server, wherein,
the configuration center receives and stores PHP configuration parameters set by a user;
monitoring the change of PHP configuration parameters of a configuration center by an agent service module of the server, acquiring updated PHP configuration parameters from the configuration center when the change of the PHP configuration parameters of the configuration center is found, and storing the PHP configuration parameters into a PHP configuration file of an appointed storage directory;
and the PHP application program installed in the server reads the PHP configuration file from the specified directory.
In the application, the PHP dynamic configuration automatic validation system comprises a configuration center and a server with an agent service module, wherein the configuration center receives and stores PHP configuration parameters set by a user; monitoring the change of PHP configuration parameters of a configuration center by an agent service module of the server, acquiring updated PHP configuration parameters from the configuration center when the change of the PHP configuration parameters of the configuration center is found, and storing the PHP configuration parameters into a PHP configuration file of an appointed storage directory; and the PHP application program installed in the server reads the PHP configuration file from the specified directory. Therefore, when the parameters of the PHP application programs are modified, the parameters can be directly modified on an interface provided by the configuration center, the parameter modification process is greatly simplified, after the configuration is finished, the relevant modifications can be synchronized to the corresponding PHP configuration files of the server where each PHP application program is located in real time, and one server is not needed for modifying the configuration; the configuration parameters are uniformly managed by the configuration center and are not stored in codes, so that sensitive information can be effectively prevented. Therefore, the PHP dynamic configuration automatic effect method is efficient, convenient and high in safety.
Drawings
Fig. 1 is a flowchart of a PHP dynamic configuration automation validation method according to an embodiment of the present application.
Fig. 2 is a schematic diagram of a PHP dynamic configuration automation validation system according to an embodiment of the present application.
Detailed Description
In order to make the purpose, technical solution and beneficial effects of the present application more clear and more obvious, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
In order to explain the technical solution described in the present application, the following description will be given by way of specific examples.
Please refer to fig. 1, which is a flowchart of an automatic PHP dynamic configuration validation method according to an embodiment of the present application, wherein the automatic PHP dynamic configuration validation method according to an embodiment of the present application includes the following steps:
s101, the configuration center receives and stores PHP configuration parameters set by a user.
In an embodiment of the present application, the configuration center supports the following functions: and the monitoring mechanism supports the storage of configuration parameters, the acquisition of PHP configuration parameters through an API (application program interface) and the change of the PHP configuration parameters. For example, the configuration center may be an Apollo configuration center for journey, and the Apollo configuration center is an open source configuration management center developed by a journey-carrying framework department, and is capable of centrally managing configurations of different environments and different clusters, and pushing the configurations to an application terminal in real time after configuration modification, and has characteristics of standard authority, flow management, and the like.
In an embodiment of the present application, S101 may specifically be:
the configuration center receives and stores the PHP configuration parameters set by the user through the interface of the configuration center, and the PHP configuration parameters can be configuration parameters split according to preset dimensions, for example, split according to application or split according to a service line.
In an embodiment of the present application, considering that the code of the PHP is covered when the code is issued, a preset storage directory of the PHP configuration parameters is different from a storage directory of the code of the PHP, for example, the code of the PHP is all placed in/home/data/www/{ application name }, and the storage directory of the PHP configuration parameters can be agreed to/home/data/config/{ application name }, so that the PHP configuration parameters can be prevented from being affected by the code issuance. In addition, a user of the PHP-FPM process has a read permission for the storage directory, and the situation that the configuration file cannot be read due to no permission is avoided.
S102, monitoring PHP configuration parameter change of a configuration center by a proxy service module of the server, acquiring updated PHP configuration parameters from the configuration center when the PHP configuration parameters of the configuration center are found to be changed, and storing the PHP configuration parameters into a PHP configuration file of an appointed storage directory.
Because Golang's performance is higher, less memory is occupied, and deployment is easy, in the embodiment of the application, the agent service module is written by Golang.
In an embodiment of the present application, when the proxy service module is deployed, a correct website of the configuration center needs to be configured, and for the configuration center with permission to be verified, a correct token or user name and password need to be configured, so as to ensure that the configured token and user name have permission to read the PHP configuration parameters and monitor the change of the PHP configuration parameters, and simultaneously, it needs to ensure that the proxy service module has read-write permission for the storage directory of the agreed configuration file, thereby avoiding that the PHP configuration file cannot be normally read or written due to permission problems.
S103, reading the PHP configuration file from the specified directory by the PHP application program installed in the server.
Referring to fig. 2, the PHP dynamic configuration automatic validation system provided in an embodiment of the present application includes a configuration center 11 and a server 12, wherein,
the configuration center 11 receives and stores the PHP configuration parameters set by the user;
the proxy service module 121 of the server 12 monitors a change in the PHP configuration parameters of the configuration center, and when the change in the PHP configuration parameters of the configuration center is found, obtains updated PHP configuration parameters from the configuration center, and stores the PHP configuration parameters in the PHP configuration file 122 of the designated storage directory;
the PHP application 123 installed in the server 12 reads the PHP configuration file from the specified directory.
The PHP dynamic configuration automatic validation system provided in an embodiment of the present application and the PHP dynamic configuration automatic validation method provided in an embodiment of the present application belong to the same concept, and the specific implementation process thereof is detailed throughout the entire specification and will not be described herein again.
In the application, the PHP dynamic configuration automatic validation system comprises a configuration center and a server with an agent service module, wherein the configuration center receives and stores PHP configuration parameters set by a user; monitoring the change of PHP configuration parameters of a configuration center by an agent service module of the server, acquiring updated PHP configuration parameters from the configuration center when the change of the PHP configuration parameters of the configuration center is found, and storing the PHP configuration parameters into a PHP configuration file of an appointed storage directory; and the PHP application program installed in the server reads the PHP configuration file from the specified directory. Therefore, when the parameters of the PHP application programs are modified, the parameters can be directly modified on an interface provided by the configuration center, the parameter modification process is greatly simplified, after the configuration is finished, the relevant modifications can be synchronized to the corresponding PHP configuration files of the server where each PHP application program is located in real time, and one server is not needed for modifying the configuration; the configuration parameters are uniformly managed by the configuration center and are not stored in codes, so that sensitive information can be effectively prevented. Therefore, the PHP dynamic configuration automatic effect method is efficient, convenient and high in safety.
It should be understood that the steps in the embodiments of the present application are not necessarily performed in the order indicated by the step numbers. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in various embodiments may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least some of the sub-steps or stages of other steps.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a non-volatile computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the program is executed. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only show some embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A PHP dynamic configuration automation validation method, characterized in that the method comprises:
the configuration center receives and stores PHP configuration parameters set by a user;
monitoring the change of PHP configuration parameters of a configuration center by an agent service module of the server, acquiring updated PHP configuration parameters from the configuration center when the change of the PHP configuration parameters of the configuration center is found, and storing the PHP configuration parameters into a PHP configuration file of an appointed storage directory;
and the PHP application program installed in the server reads the PHP configuration file from the specified directory.
2. The method of claim 1, wherein the configuration center supports the following functions: and the monitoring mechanism supports the storage of the configuration parameters, the acquisition of the PHP configuration parameters through an API (application programming interface) and the change of the PHP configuration parameters.
3. The method of claim 2, wherein the configuration center is an Apollo configuration center.
4. The method as claimed in claim 1, wherein the configuration center receives and stores the PHP configuration parameters set by the user specifically as follows:
the configuration center receives and stores PHP configuration parameters set by a user through an interface of the configuration center.
5. The method of claim 4, wherein the PHP configuration parameters are configuration parameters split in preset dimensions.
6. The method of claim 1, wherein the storage directory of PHP configuration parameters is different from the storage directory of PHP code.
7. The method of claim 1, wherein the proxy service module is written in Golang.
8. An automatic PHP dynamic configuration effect system is characterized by comprising a configuration center and a server, wherein,
the configuration center receives and stores PHP configuration parameters set by a user;
monitoring the change of PHP configuration parameters of a configuration center by an agent service module of the server, acquiring updated PHP configuration parameters from the configuration center when the change of the PHP configuration parameters of the configuration center is found, and storing the PHP configuration parameters into a PHP configuration file of an appointed storage directory;
and the PHP application program installed in the server reads the PHP configuration file from the specified directory.
9. The system of claim 8, wherein the storage directory of PHP configuration parameters is different from the storage directory of PHP code.
10. The system of claim 8, wherein the proxy service module is written in Golang.
CN202110315593.0A 2021-03-24 2021-03-24 PHP dynamic configuration automatic validation method and system Pending CN113157332A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110315593.0A CN113157332A (en) 2021-03-24 2021-03-24 PHP dynamic configuration automatic validation method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110315593.0A CN113157332A (en) 2021-03-24 2021-03-24 PHP dynamic configuration automatic validation method and system

Publications (1)

Publication Number Publication Date
CN113157332A true CN113157332A (en) 2021-07-23

Family

ID=76884750

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110315593.0A Pending CN113157332A (en) 2021-03-24 2021-03-24 PHP dynamic configuration automatic validation method and system

Country Status (1)

Country Link
CN (1) CN113157332A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103516538A (en) * 2012-06-28 2014-01-15 中兴通讯股份有限公司 Method and device for uniform configuration of carrier-class clustered applications
CN107368331A (en) * 2017-06-26 2017-11-21 聚好看科技股份有限公司 The configuration file update method and device of application program
CN108196876A (en) * 2017-11-29 2018-06-22 链家网(北京)科技有限公司 PHP business collocation methods and central server based on file
CN108804119A (en) * 2018-04-28 2018-11-13 北京金山云网络技术有限公司 Configure update method, device, system, configuration center, application node and medium
CN109947464A (en) * 2019-03-22 2019-06-28 优信拍(北京)信息科技有限公司 A kind of configuration update method and device
CN109976822A (en) * 2017-12-25 2019-07-05 中国电信股份有限公司 Configuration method, device and the distributed system of Distributed Application
CN112379948A (en) * 2020-12-02 2021-02-19 腾讯科技(深圳)有限公司 Program configuration management method and device, storage medium and electronic equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103516538A (en) * 2012-06-28 2014-01-15 中兴通讯股份有限公司 Method and device for uniform configuration of carrier-class clustered applications
CN107368331A (en) * 2017-06-26 2017-11-21 聚好看科技股份有限公司 The configuration file update method and device of application program
CN108196876A (en) * 2017-11-29 2018-06-22 链家网(北京)科技有限公司 PHP business collocation methods and central server based on file
CN109976822A (en) * 2017-12-25 2019-07-05 中国电信股份有限公司 Configuration method, device and the distributed system of Distributed Application
CN108804119A (en) * 2018-04-28 2018-11-13 北京金山云网络技术有限公司 Configure update method, device, system, configuration center, application node and medium
CN109947464A (en) * 2019-03-22 2019-06-28 优信拍(北京)信息科技有限公司 A kind of configuration update method and device
CN112379948A (en) * 2020-12-02 2021-02-19 腾讯科技(深圳)有限公司 Program configuration management method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN110046029A (en) Data processing method and device applied to multi-level buffer in cluster
CN109815680B (en) Application authority management method and device, terminal equipment and storage medium
CN111857777B (en) System updating method and device based on double-core intelligent ammeter and computer equipment
CN111414391A (en) Method and system for accessing multiple data sources
CN107870802B (en) Virtual machine migration method and device
CN113110853B (en) Configuration data online downloading method and device and electronic equipment
CN113360250B (en) Application service resource control method, device, equipment and medium
CN113448862B (en) Software version testing method and device and computer equipment
CN108255708A (en) Method, apparatus, storage medium and the equipment of production file are accessed in test environment
CN114047968B (en) Method, system, storage medium and equipment for automatic hardware adaptation
CN113157332A (en) PHP dynamic configuration automatic validation method and system
CN112199099B (en) Application updating method, device, server and storage medium
CN112052032B (en) Brushing method and device of electronic control unit
CN112631646A (en) Data compatibility method, device and equipment for APP version degradation and storage medium
CN111078525A (en) Method and device for adjusting system running time, computer equipment and storage medium
CN111835513B (en) Method, device and equipment for updating certificate data
CN113608831B (en) Plug-in instance management method, system, storage medium and equipment
CN112148597B (en) Method for eliminating iOS device authorization dialog box, test method and storage medium
CN115357594A (en) Block chain-based data model updating method and related equipment
CN107291439B (en) Target incremental data construction method and device
CN114218032A (en) Hardware design verification method and device, electronic equipment and storage medium
CN111491021B (en) License data processing method and device for distributed cluster
CN114091037A (en) Protection method for system data in control system and related device
CN113778551A (en) Method and device for remotely modifying parameters based on multiple clients and computer equipment
CN113254158A (en) Deployment method and device of deep learning system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination