-2

I have a server running PHP using mod_php in Apache. Apache is using the Prefork MPM. I had some SSL errors due to using an old version of CURL.

I ran the command 'sudo yum update curl'.

It successfully updated curl, but I noticed I was still getting the SSL errors intermittently. A simple restart of Apache fixed this.

So my 2 questions are..

  1. Why was an apache restart required? ie php.ini was not modified (unless yum did this behind the scenes)?

  2. Why did the SSL errors only happen intermittently?. ie why didn't it just not work until apache was restarted?

Florin Asăvoaie
  • 7,057
  • 23
  • 35
mcs
  • 1
  • 1
  • 1
    Correlation is not causation and seriously - how can we possibly know why something on your system was intermittent with the information you have provided? – user9517 Dec 23 '16 at 20:01
  • There, I clarified the question and answered it too :). – Florin Asăvoaie Dec 23 '16 at 21:15
  • Thank you florin for the detailed answer. i have a couple suggestions on your tone however.. "you dont know how it works". That is the reason i am asking the question. These kinds of comments are negative and deter people from asking questions. Also, "I advise you to proceed on knowing your job". This type of comment does nothing but breed insecurity for those wanting to grow. – mcs Dec 24 '16 at 20:52
  • 1
    If someone tells me that, all I understand is that I need to start learning more. If you can't stand the truth, that's it. I tried to give you honest advice. And the reason for my "tone" is because this site is for PROFESSIONAL users. – Florin Asăvoaie Dec 26 '16 at 11:53
  • Of course i have to learn more. Thats why im here asking. To learn. If this site is for professionals why are you here? Professionals know how to help without fegrading others. – mcs Dec 27 '16 at 16:38

1 Answers1

3

First, this question is highly related to shared libraries in Linux (and not only) and you don't know how it works. It is essential knowledge if you want to work in a business environment as this website suggests so I highly advise you to proceed on knowing your job.

  1. Because you use mod_php, this means that the PHP code is interpreted inside the Apache processes. Shared libraries typically get loaded when a process starts, so unless you restart it, it will, of course continue to use the old libraries (imagine what a mess would be if it wouldn't, regarding all those function pointers it knows from the previous library!).

  2. From the information you provided, I am assuming you are running Apache with the prefork MPM. It means that Apache spawns processes "every now and then", according to an algorithm it has and some parameters you give it in a configuration file. Now, forked processes inherit the memory of the processes that are spawning them (actually it's copied, using CoW). This includes all the shared libraries that were loaded. My guess is that PHP is being initialized lazy, when each forked process needs it for the first time, or something like this. When your request ended up on a process that was spawned before the CURL update, you were getting an error. When your request ended up on a process that was spawned after the CURL update, you were not getting the error, since the PHP engine in that process loaded the new CURL library.

A good practice, when updating libraries, is to make sure that you restart all services that are using it, to avoid exactly this kind of trouble and not only.

Florin Asăvoaie
  • 7,057
  • 23
  • 35
  • 1
    On RHEL 7 you can run `needs-restarting` (`dnf needs-restarting` on Fedora and future RHEL 8) to identify the services that need to be restarted due to this. – Michael Hampton Dec 23 '16 at 21:23