Post B1kWR7JRZ2xy3saAxk by suorcd@podcastindex.social
 (DIR) More posts by suorcd@podcastindex.social
 (DIR) Post #B1kQBUZQj0lXpuE5lQ by matthew@social.retroedge.tech
       2025-12-29T17:35:12.143745Z
       
       0 likes, 0 repeats
       
       Okay. PHP website question: A client has an apache2 web server with multiple PHP based websites on it, probably around 20. One of the websites just started taking a really long time to respond, at first, but then when it finally does load it seems to work mostly fine with quick response times to subsequent page loads for sub pages on the website. The other websites on the same physical server and apache2 seem to be fine and do not exhibit this behavior. The dev site version has a tool to show "build time" in the footer. It is really long on first load (often over two minutes) but then super quick after the client session has made a connection. Any suggestions on how I should go about testing to figure out what is wrong? Note: I am not the PHP programmer for these websites, but the sysadmin, but I am in close communication with the programmer. #PHP #webdev #sysadmin #apache
       
 (DIR) Post #B1kRMC7HmCpNk3jGlM by outofcontrol@phpc.social
       2025-12-29T17:45:23Z
       
       0 likes, 0 repeats
       
       @matthew Does this server have an administrative control panel like plesk or cpanel? Those control each site as independent, each loading their own PHP plugins and managing versions etc? They will also manage resources per site.
       
 (DIR) Post #B1kRMDVQbvjY3E2424 by matthew@social.retroedge.tech
       2025-12-29T17:48:20.317267Z
       
       0 likes, 0 repeats
       
       No plesk or cpanel. Just one apache2 server with multiple conf files enabled, one for each website.
       
 (DIR) Post #B1kRNAPnaVHskqqtwu by swistak@phpc.social
       2025-12-29T17:46:53Z
       
       1 likes, 0 repeats
       
       @matthew I don't know how your web application works but I think on first page view it calculate something and store values somewhere (database/filesystem/session/browser) probably with some expiration (date / TTL). After next refresh the values are served from "cache" for current user.   To test it you should turn off the browser cache and easier way is to var_dump or track each php script execution time like:https://stackoverflow.com/questions/535020/tracking-the-script-execution-time-in-php
       
 (DIR) Post #B1kRg1oLnkWfZWKW12 by damien@layer8.space
       2025-12-29T17:51:25Z
       
       1 likes, 0 repeats
       
       @matthew slow SQL queries that get cached and are therefore fast after? Or (less likely IMO) PHP OPcache having the same "healing" effects on some very inefficient PHP code?I'd suggest to start with SQL slow query logs and/or viewing SQL process list when it's loading slowly.
       
 (DIR) Post #B1kRglMyPrxWrvsIjI by psys_@mk.hotolab.win
       2025-12-29T17:51:53.301Z
       
       1 likes, 0 repeats
       
       @matthew@social.retroedge.tech By chance, is SQL involved in any way? A while back, I had an issue like that with the same symptoms that ended up being a severely undersized connection pool on the application side.
       
 (DIR) Post #B1kRruK1TJB9osoCZ6 by matthew@social.retroedge.tech
       2025-12-29T17:54:06.027637Z
       
       0 likes, 0 repeats
       
       Thanks. SQL is involved. I haven't yet tried checking for slow query logs. I am looking at the apache error log and seeing some warnings related to h2_stream - some people are mentioning that there may be an apache2 bug with the http2 module in apache and that disabling it may resolve the performance issues.
       
 (DIR) Post #B1kVAhKkHn5mtxnYye by matthew@social.retroedge.tech
       2025-12-29T18:31:05.980437Z
       
       0 likes, 0 repeats
       
       I enabled the slow query log. The other websites on this server also have slow queries (between 2 and 2.5 seconds, but not over) and those website do not have the slow initial load time like the problem website. So slow MYSQL queries is likely not the cause of this specific problem. I appreciate your suggestion, though, as eliminating potential problems may help in identifying the cause.
       
 (DIR) Post #B1kVe4RRRxSGy3w7jU by outofcontrol@phpc.social
       2025-12-29T18:23:25Z
       
       1 likes, 0 repeats
       
       @matthew I’d then try to find what on that page is taking so long to build. Possibly PHP memory limit or one or more slow mysql queries.
       
 (DIR) Post #B1kVl8hY0iaeCqqAe8 by matthew@social.retroedge.tech
       2025-12-29T18:37:42.465232Z
       
       0 likes, 0 repeats
       
       Other websites on this apache and php-fpm seem fine, so probably not memory limited. I enabled slow mysql queries log. The other websites have slower queries than the problem website. So probably that is not the cause. But thank you for the reply and suggestions!
       
 (DIR) Post #B1kVwTtDZcdT6chuwC by suorcd@podcastindex.social
       2025-12-29T18:33:28Z
       
       0 likes, 0 repeats
       
       @matthew is it using prefork or php-fpm?
       
 (DIR) Post #B1kVwUWDEdpN3Yx3ia by matthew@social.retroedge.tech
       2025-12-29T18:39:42.996558Z
       
       0 likes, 0 repeats
       
       php7.4-fpmthat php7.4-fpm service has been running for 8 months with no downtime or restart. I could try restarting the php7.4-fpm service... but not sure why that would help based on that the server has almost no load on it. Maybe worth trying to see what restarting that service does. #php
       
 (DIR) Post #B1kWCSWoP2Y1W6qW6C by matthew@social.retroedge.tech
       2025-12-29T18:42:38.401261Z
       
       0 likes, 0 repeats
       
       Status Update: restarting php7.4-fpm service did not change the behavior.
       
 (DIR) Post #B1kWE87ZFO9KnvppBo by verita84@poster.place
       2025-12-29T18:42:58.162Z
       
       0 likes, 0 repeats
       
       @matthew@social.retroedge.tech @suorcd@podcastindex.social that old AF yo
       
 (DIR) Post #B1kWHqxH0oAgitnMiO by suorcd@podcastindex.social
       2025-12-29T18:43:30Z
       
       1 likes, 0 repeats
       
       @verita84 @matthew indeed
       
 (DIR) Post #B1kWK8BfuiTGkOcMEq by verita84@poster.place
       2025-12-29T18:44:03.132Z
       
       0 likes, 0 repeats
       
       @posterchan @suorcd@podcastindex.social @matthew@social.retroedge.tech search when did php 7.4 come out
       
 (DIR) Post #B1kWR7JRZ2xy3saAxk by suorcd@podcastindex.social
       2025-12-29T18:42:53Z
       
       0 likes, 0 repeats
       
       @matthew the cache can get leaky due to the app or php-7.4 plus the extensions.Is opcache turned on?
       
 (DIR) Post #B1kWR8iIM8RIPFDXKy by matthew@social.retroedge.tech
       2025-12-29T18:45:16.438270Z
       
       0 likes, 0 repeats
       
       opcache is NOT turned on. do you think it should be?
       
 (DIR) Post #B1kWbIJFX6jx40LQlU by matthew@social.retroedge.tech
       2025-12-29T18:47:08.208645Z
       
       0 likes, 0 repeats
       
       Yes, it is old... but the rest of the websites on this server work fine, so the cause is not strictly because it is old.
       
 (DIR) Post #B1kWf9dNjHqzJebNpI by verita84@poster.place
       2025-12-29T18:47:45.877Z
       
       0 likes, 0 repeats
       
       @matthew@social.retroedge.tech @posterchan @suorcd@podcastindex.social not even supported any more it seems
       
 (DIR) Post #B1kWmOSb0N0vKE0bqq by matthew@social.retroedge.tech
       2025-12-29T18:49:08.211565Z
       
       1 likes, 0 repeats
       
       Correct. The plan is eventually to migrate the websites off this server to Debian 13 with PHP 8.something... but that likely is not the cause of this problem.
       
 (DIR) Post #B1kWosV4HwUn4ULl5M by suorcd@podcastindex.social
       2025-12-29T18:47:29Z
       
       0 likes, 0 repeats
       
       @matthew yes. in a past life it was a must with php apps
       
 (DIR) Post #B1kWothVpA2mnNBD7Y by matthew@social.retroedge.tech
       2025-12-29T18:49:35.016906Z
       
       0 likes, 0 repeats
       
       Thank you. I will try enabling opcache.
       
 (DIR) Post #B1kXRm85uLHqbi9T96 by suorcd@podcastindex.social
       2025-12-29T18:51:32Z
       
       0 likes, 0 repeats
       
       @matthew it should take a couple requests for the opcache to work its magic; caching the opcode
       
 (DIR) Post #B1kXRnPV96nyZzIsuu by matthew@social.retroedge.tech
       2025-12-29T18:56:31.056967Z
       
       0 likes, 0 repeats
       
       Thanks. Enabled now. I don't think that fixed the issue, as still super slow load times on initial session request, but I'll try a few more times in case it takes a while for the cache to kick in and make a difference.
       
 (DIR) Post #B1kXlvmhiiuALLl2Lg by suorcd@podcastindex.social
       2025-12-29T18:54:10Z
       
       0 likes, 0 repeats
       
       @matthew if you think it is an old Apache, you could try just setting up Apache on the new os and see if that helps
       
 (DIR) Post #B1kXlx94f2OQZ1EPr6 by matthew@social.retroedge.tech
       2025-12-29T19:00:14.343375Z
       
       0 likes, 0 repeats
       
       Yeah, we are kicking that idea around. I don't think it is caused by the older version as other websites are working fine. But running out of things to try. I think there will be quite a few undocumented dependencies to try to find and set up on the newer replacement server.
       
 (DIR) Post #B1kYVmmfW58ZkWbeV6 by suorcd@podcastindex.social
       2025-12-29T19:07:49Z
       
       1 likes, 0 repeats
       
       @matthew then make sure to get a copy of the phpinfo() output; either webpage or cli. That should give a good pale to start
       
 (DIR) Post #B1kaUCbmjMHDAht8IC by heiglandreas@phpc.social
       2025-12-29T19:16:53Z
       
       1 likes, 0 repeats
       
       @matthew Sounds like a caching issue. Have you checked whether Opcache is an issue? Or actually loading and parsing the files....A profiler like @Tideways might.give you more insights into.where tue scripts are actually slow....
       
 (DIR) Post #B1kabDLWO0jjUEcmps by matthew@social.retroedge.tech
       2025-12-29T19:31:56.544159Z
       
       2 likes, 1 repeats
       
       Thank you for your reply!Looks like it was a call to an external website: 'http://www.geoplugin.net/php.gp?ip=' . $_SERVER['REMOTE_ADDR']GeoPlugin must have just paywalled that service and instead of failing gracefully, it just hung the website for about two minutes. So we have likely identified the cause of this mysterious problem.