简体   繁体   中英

Execute PHP script after php-fpm master process is restarted

Say I have a script to populate the PHP APC cache when PHP is restarted, the cache is empty.

Is it possible to create a mechanism to autorun some kind of script when the master php-fpm process is started?

Open php-fpm

vim /etc/init.d/php-fpm

In the file, find the start function, add your commands at the end.

start () {
    ...
    # Your commands here
}

Save and restart php-fpm

I have one article for you please once read it, It might be helpful to you Link

Open php-frm through CMD

Ubantu sudo gedit /etc/init.d/php-fpm

You put the code under following function.

function start {
   /* 
     Your code here
   */
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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