Skip to main content

Notes on PHP-FPM and phpredis

I have a Laravel 5.7 project and use redis for some caching. I have problem with redis driver predis vs phpredis. Predis often work well since it more simple (?)  But phpredis not work  (this one faster). This is due to my Dev server not use php-fpm as Production. So I forgot restart php-fpm to reflect phpredis install.

This one reveal some good lessons. 
First, production rarely restart so we have manually restart php-fpm. 
Second, I have often check open port using netstat -pentl (sudo optional)
And I assumed that php-fpm run on TCP port 900 or 900x because I see many setup forlow this way. So when list port open, I do not see 900x and think server not use php-fpm. 
My mistake reveal when I use ps aux  and grep fpm. So ut use default setting, run over Unix socket .sock. Knowing system use php-fpm and I instanly understand why my phpredis install not work.

Third, this is interesting. On the way to investigate why prod server not recognize phpredis. I try raw php and ut seem work well. Have no idea, I try create new laravel project with phpredis driver, and you know what? 
It's also work, but I use php artisan serve to run debug project. And it's different from serve with Apache. Apache use php-fpm, so without restart php-fpm, phpredis driver not take effect. So next time to debug PHP-Apache make sure you have same config.


This issue is one of the problem during our upgrade laravel and optimize something.
Upgrading lavel from 5.7
 to 6.18 LTS (6.2?) have issues with Eloquent relationship... This is another story.

https://stackoverflow.com/questions/33973967/why-do-i-have-to-run-composer-dump-autoload-command-to-make-migrations-work-in

https://apple.stackexchange.com/questions/14163/how-to-configure-terminal-to-be-putty-like-when-it-comes-to-copy-paste-with-mo

select count(distinct `user_id`) as aggregate from `UserFollowData` where `UserFollowData`.`follow_user_id` = '575fcaaa4518e' and `UserFollowData`.`follow_user_id` is not null and exists (select * from `UserData` where `UserFollowData`.`user_id` = `UserData`.`user_id` and `UserData`.`deleted_at` is null);

select count(*) as aggregate from `UserFollowData` where `UserFollowData`.`user_id` = '575fcaaa4518e' and `UserFollowData`.`user_id` is not null and exists (select * from `UserData` where `UserFollowData`.`follow_user_id` = `UserData`.`user_id` and `UserData`.`deleted_at` is null);


yeah dam mis  information:
Running the composer install uses the composer. lock file, which now has the “lock” on all packages you have installed on the project. ... In the case of composer update , it does not use the lock file, instead it uses the composer. json file and updates the packages(if updates have been released in the last 3 months).



Comments

Popular posts from this blog

Rand mm 10

https://stackoverflow.com/questions/2447791/define-vs-const Oh const vs define, many time I got unexpected interview question. As this one, I do not know much or try to study this. My work flow, and I believe of many programmer is that search topic only when we have task or job to tackle. We ignore many 'basic', 'fundamental' documents, RTFM is boring. So I think it is a trade off between the two way of study language. And I think there are a bridge or balanced way to extract both advantage of two method. There are some huge issue with programmer like me that prevent we master some technique that take only little time if doing properly. For example, some Red Hat certificate program, lesson, course that I have learned during Collage gave our exceptional useful when it cover almost all topic while working with Linux. I remember it called something like RHEL (RedHat Enterprise Linux) Certificate... I think there are many tons of documents, guide n books about Linux bu

Martin Fowler - Software Architecture - Making Architecture matter

  https://martinfowler.com/architecture/ One can appreciate the point of this presentation when one's sense of code smell is trained, functional and utilized. Those controlling the budget as well as developer leads should understand the design stamina hypothesis, so that the appropriate focus and priority is given to internal quality - otherwise pay a high price soon. Andrew Farrell 8 months ago I love that he was able to give an important lesson on the “How?” of software architecture at the very end: delegate decisions to those with the time to focus on them. Very nice and straight-forward talk about the value of software architecture For me, architecture is the distribution of complexity in a system. And also, how subsystems communicate with each other. A battle between craftmanship and the economics and economics always win... https://hackernoon.com/applying-clean-architecture-on-web-application-with-modular-pattern-7b11f1b89011 1. Independent of Frameworks 2. Testable 3. Indepe