<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jun 13, 2018 at 12:11 AM, Stephen Collier <span dir="ltr"><<a href="mailto:stephenbcollier@gmail.com" target="_blank">stephenbcollier@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <p>Let me know if you don't get a response. I have a look and see
      how we do it. We both Ubuntu and Redhat at work serving huge web
      loads. Its a while since i set one up, but php being not thread
      safe is a pain.</p></div></blockquote><div>Kevon, I'm not quite sure how you have your webserver setup, but usually one uses PHP-FPM and proxy_fcgi (Apache 2.4, if you have 2.2 then you probably should upgrade) ; you don't leave PHP compiled as a DSO to be linked into Apache at runtime.</div><div><br></div><div>This separation allows for better front-end static file scaling, and PHP in the FastCGI Process Manager mode is basically a queue of multiple PHP runners available to take a php request from the webserver each as a separate process. Since no processes are spawned, simply some inter-process communication, there is very low latency and far less memory thrashing than with prefork/CGI and performance pretty much on-par with prefork+DSO. </div><div><br></div><div>You could even put the PHP process manager on a wholly different computer or cluster, and only have a web front-end serving content.  The FPM connects to Apache with a simple TCP socket.  </div><div><br></div><div>The other, far less used (but required in very old cases of multithreaded webservers before FastCGI was a thing, such as Roxen 2....from 2001...yes I'm old) was to enable the ZTS Zend Thread Safety option upon compiling PHP.  This would allow you to link the DSO into Apache Event-MPM without it crashing; but you suffer in performance, because PHP's code was initially designed to be stateless, and keeping a threaded state while 1 web process may be handling a ton of requests at a given time, incurs a performance penalty.</div><div><br></div><div>So you can toss out mpm-prefork if you really want to use Event, as long as you use the PHP-FPM / proxy_fcgi method.   It should stand to be noted that the vast majority of Distribution-provided PHP installs are NON-threadsafe, which implies prefork+dso OR CGI OR FPM; to get thread safety you'd need to very likely compile PHP manually.</div><div><br></div><div>Mike</div><div><br></div></div></div></div>