Topic on Project:Support desk

Best practices for updating LocalSettings.php for a live MediaWiki

7
Summary by Nnaka1

Updated PHP-FPM settings to enable cache invalidation at a reasonable frequency.

Nnaka1 (talkcontribs)

I am currently developing on my own instance of MediaWiki, which means making changes to the LocalSettings.php.

I have found that in order for my changes to the LocalSettings.php to be picked up, I need to "bounce" / restart my php fpm. This seems quite heavy handed and not the best practice because if I were to have other PHP processes running, they would be impacted. May I know what the best way to do runtime LocalSettings.php updates to an instance of MediaWiki?

Bawolff (talkcontribs)

normally you dont need to do anything for changes to be picked up. Whatever you are experiencing might be some sort of php config issue.

Check also you dont have your php on an NFS (or SMB, etc) file system as network filesystems can sometimes mess this up.

Hazard-SJ (talkcontribs)

Also look into whether you have any PHP caching in place.

Nnaka1 (talkcontribs)

Thanks, yes, any changes I would expect to get picked up the next call that's made.

I made sure that PHP is host local.

I'm using PHP-FPM along with Apache HTTPD. From looking at the PHP-FPM extra.ini file, I see that I set realpath_cache value. From my research it seems that I may need to do a reload of PHP-FPM for this to be cleared but this still seems quite invasive. I'm curious how this sort of set-up / process is typically done / supported in a production environment?

Nnaka1 (talkcontribs)

I am also seeing that in my opcache.ini I have the opcache.enable=1. From what I read, this seems to provide some performance enhancements, but I have a hunch that this could also potentially be the cause of this. But would love to know what your experience is for this as well.

Bawolff (talkcontribs)

Just to be clear, if you add the last line of LocalSettings.php to be:

die("dead");

Nothing changes until you restart php-fpm (including both normal pages and special pages)? Because that is super weird.

Might make sense to ask on a php forum as they might have people who know better how php internals work

Nnaka1 (talkcontribs)

Thanks for the help, @Bawolff@Hazard-SJ

Changing those settings in PHP-FPM seemed to do the trick so I do believe it was indeed the cache that was not getting invalidated causing the changes not to get picked up.