-1

PHP is not recompiling properly.

I have PHP 7.2 installed on Nginx using php-fpm on Centos 7. I am recompiling php with more options using ./configure, make clean, make, make test and make install.

Everything works well and no errors are thrown, except the updated php compile is not being reflected on the phpinfo(); table. If you see the "Build Date" it is not changing. The "Configure Command" is also not updating after recompiling.

Why could php not be recompiling and the "Build Date" not updating, and the "Configure Command" also not reflecting my changes?

I have restarted nginx, restarted php-fpm, and still no change. I can edit the php.ini file without problems as well and they do update, but the php itself is not updating after I recompile and add more options (--with-openssl). I even restarted the server. PHP files are served fine.

Can anybody help?

kintsukuroi
  • 1,332
  • 16
  • 15
  • I was genuinely stuck with this problem for several hours, seems unfair to have the question downvoted a few minutes after I posted. It would have definitely helped me and therefore it can help others. – kintsukuroi Apr 24 '18 at 00:14

1 Answers1

0

I just figured it out after about half a day.

The reason the new php recompile was not being recognized was because I needed to manually copy the new updated php-fpm program to the /usr/local/bin directory, like this:

cp sapi/fpm/php-fpm /usr/local/bin

And that fixed it. So basically php WAS being recompiled correctly, but that was not seen by the system because php-fpm was not manually copied to the directory nginx uses to pull php-fpm from. The file must be overwritten while php-fpm is turned off.

Bonus Tip

This is my command to reload php, php-fpm and nginx after recompiling:

# gracefully stop the php-fpm process
pkill -15 php-fpm

# copy the new recompiled php-fpm to the executable directory
cp -f sapi/fpm/php-fpm /usr/local/bin

# start php-fpm
/usr/local/bin/php-fpm

# signal nginx to reload
nginx -s reload

All in one line:

pkill -15 php-fpm && cp -f sapi/fpm/php-fpm /usr/local/bin && /usr/local/bin/php-fpm && nginx -s reload
kintsukuroi
  • 1,332
  • 16
  • 15