您的位置 首页 php

PHP生命周期及fpm的运作方式

PHP生命周期及fpm(FastCGI进程管理器)的运作方式

PHP在web方式中如何改了文件就立即生效的,重要的几个概念:

● sapi: 可以简单的理解为php引擎对外的一个统一接口,使得php可以和外部程序进行交互

● php的生命周期中关键四个调用: MINT -> RINT -> RSHUTDOWN -> MSHUTDOWN

● fpm: fastcgi进程管理器

fpm方式的流程就是:

fpm通过sapi接口与php进程交互

1.fpm启动会调用各扩展的MINT方法,进行一些数据初始化(长驻内存)

2.每个请求过来,先会执行RINT对单个请求行一个初始化

3.执行php脚本(在没有缓存opcode的情况下,这里的php脚本是动态执行的,所以更新php脚本后,会执行新的php脚本,详情不在这里叙述)

4.执行RSHUTDOWN方法

5.如果你要停止fpm了,才会执行MSHUTDOWN

fpm对每个请求的处理都是一直在在重复执行 2~4步,在第三步中,php的脚本是动态执行的,由于每次都要执行一次php脚本,而每次php脚本都要有一个把php文件翻译成opcode的流程(比较耗时), 于是就产生的opcache工具。

opcache

直接把php翻译后的opcode代码树保存到共享内存中,以便直接使用,从而减少每次都把php翻译成opcode的开销。

opcache的问题: 按照他的描述,修改了php文件,并不能立即被更新。

opcache的解决方案: 有一个配置来设置隔多长时间检测文件是否更新了,从而有机会在第二步重新来reload相关的文件。

当然,直接reload fpm,从而达到php热更新的效果(opcache扩展可以在第四步把相关的opcode cache给清空)。

图示

0a3f5bc11b74f00c471f709da262377.png

更多PHP相关知识,请访问PHP教程!

以上就是PHP生命周期及fpm的运作方式的详细内容,更多请关注求知技术网其它相关文章!

文章来源:智云一二三科技

文章标题:PHP生命周期及fpm的运作方式

文章地址:https://www.zhihuclub.com/2339.shtml

关于作者: 智云科技

热门文章

发表评论

您的电子邮箱地址不会被公开。

49条评论

  1. Definitely believe that which you said. Your favorite justification seemed to be on the web the easiest thing to be aware of. Guendolen Norbert Arman

  2. I really like your writing style, fantastic information, regards for posting : D. Suzanna Orlando Zel

  3. Good thoughts and great article. You are bang on point. I come from the so-called 3rd world country and I can totally relate to what you are saying. Laurel Inglis Hayden

  4. Here are some hyperlinks to internet sites that we link to mainly because we feel they are worth visiting. Addi Ethelbert Evangeline

  5. The most typical loans are those accustomed to purchase a home, a mortgage, car finance, and to pay for student tuition. Ester Niels Lundeen

  6. Some truly wonderful blog posts on this site, regards for contribution. Marlene Christian Mundy

  7. You made some decent points there. I did a search on the subject and found most guys will agree with your blog. Jeannette Ermin Benedix

  8. Every weekend i used to go to see this web page, as i wish for enjoyment, as this this web page conations truly nice funny information too. Nelia Briano Bel

  9. I am in fact delighted to read this website posts which includes lots of valuable information, thanks for providing such data. Carlee Brnaba Johannes

  10. The cleaning firm carries out cleansing of areas of different sizes as well as arrangements. Lenna Lutero Medeah

  11. I think the admin of this website is really working hard in favor of his website, since here every stuff is quality based information. Angele Goraud Kellia

  12. This post gives clear idea for the new people of blogging, that in fact how to do blogging and site-building. Lynda Dunc Wood

  13. This article offers clear idea in support of the new viewers of blogging, that genuinely how to do blogging and site-building. Kristin Kelvin Natascha

  14. I am regular visitor, how are you everybody? This article posted at this site is actually fastidious. Elianore Royall Gorlicki

  15. I every time used to read piece of writing in news papers but now as I am a user of net therefore from now I am using net for articles, thanks to web. Merola Monro Alyson

  16. You made some good points there. I looked on the net for more info about the issue and found most people will go along with your views on this site. Pearle Waverly Yolane

  17. Thank you, I believe men should read this post also, because this is not just something women deal with. Emilee Ferdy Aube

  18. Only wanna remark on few general things, The website design and style is perfect, the content material is rattling great : D. Casie Bronson Grayce

  19. Definitely believe that that you said. Your favorite justification seemed to be at the web the easiest factor to consider of. Yvonne Laurie Kimbra

  20. I have been examinating out some of your stories and i can claim nice stuff. I will surely bookmark your website. Jeanelle Jeddy Addis

  21. Took me time to read the material, but I truly loved the article. It turned out to be very useful to me. Demeter Luciano Maybelle

  22. roin commodo faucibus ante ut lobortis. Nunc neque urna, cursus in scelerisque in, semper ut lacus. Bobbie Cammy Balf

  23. Its great as your other blog posts :D, appreciate it for posting. Nisse Phillipe Barbie

  24. hi!,I love your writing very so much! share we communicate extra approximately your article on AOL? I require an expert on this house to resolve my problem. Maybe that is you! Having a look forward to peer you. Nanon Gustave Zullo

  25. Excellent read, I just passed this onto a friend who was doing some research on that. And he just bought me lunch as I found it for him smile Thus let me rephrase that: Thanks for lunch! Salomi Isak Hedwiga

  26. I love it when people come together and share opinions. Great blog, keep it up! Malena Harper Kruter

  27. Someone essentially help to make seriously posts I would state. This is the first time I frequented your web page and thus far? I amazed with the research you made to make this particular publish amazing. Wonderful job! Maggy Elton Britt

  28. This is an example of a comment made on a post. You can either edit the comment, delete the comment or reply to the comment. Use this as a place to respond to the post or to share what you are thinking. Deeyn Udall Aldora

  29. I think the admin of this web site is in fact working hard in favor of his web site, as here every information is quality based stuff. Joanna Warde Costanzia

  30. SMM, kendinizi veya şirketinizi tanıtmak için Instagram, Facebook, Twitter, Youtube ve daha pek çok sosyal medya platformunun kullanılmasıdır. Çevrimiçi varlığınızı artırmanın bir yolunu arıyorsanız, en iyi ve en ucuz fiyatlarla panelimizi kullanabilirsiniz.

  31. PDF kitap indir, ücretsiz PDF kitapları indirme sitesi. İnternette arayıp bulamadığınız tüm PDF kitaplar burada. Ücretsiz Pdf Kitap indir ve Oku. Yandex Disk E Kitap Arşivi İndirme Sitesi! Ücretsiz PDF formatında e-kitap indirebileceğiniz paylaşım sitesi. inlerce PDF Kitap indir içeriğini, EPUB Kitap ve PDF Kitap formatlarıyla sitemizde bulabilirsiniz! Dilediğiniz kitabı ücretsiz bir şekilde okuyabilirsiniz.

  32. Aenean lectus elit, fermentum non, convallis id, sagittis at, neque. Nullam mauris orci, aliquet et, iaculis et, viverra vitae, ligula. Nulla ut felis in purus aliquam imperdiet. Maecenas aliquet mollis lectus

  33. I am constantly searching online for articles that can help me. Thank you! I Peter Lucax Nonahs

  34. Some genuinely nice and useful info on this internet site, as well I conceive the layout contains excellent features. Emma Tiger

  35. Mengapa saya berbicara tentang tenaga mesin? Ini adalah faktor utama kecepatan tertinggi yang tersedia untuk mobil Anda

  36. I am actually happy to read this weblog posts which consists of tons of helpful facts, thanks for providing these kinds of information.

网站地图