I have a persistent problem on one of my Joomla 3.03 websites. The script always delays for about 31 seconds between "afterDispatch" and "beforeRenderModule" before the first module that is in the renderlist.
Other websites on my server run fine
The issue is not module related...unpublishing the first module just shifts the issue to the next module in the list.
The issue seems to be template specific, replacing the template index.php with a standard "Hello world" index.php brings the page up immediately, as does switching to another template.
Deactivating js in chrome devtools does not affect the load time, still slow (I also selectively deleted all the script links that were called in the template index.php to no effect).
I am at a loss as to what is causing the issue. I tried php debugging by inserting a php function
function debug_to_console($data) {
$output = $data;
if (is_array($output))
$output = implode(',', $output);
$date = date('m/d/Y h:i:s a', time());
echo "<script>console.log('Debug Objects: " . $output . $date"' );</script>"; }
at the head of the file and inserting
debug_to_console("Introduced break point:");
at break points, but merely inserting the function without the subsequent break points causes the browser to only display "Break point" and nothing else in the browser window (not the console) immediately. this is making it hard to debug the script.
Any ideas? The website used to run fine. I am loathe to updating PHP because that might affect my other websites which all work fine.
Here is some system info:
PHP Built On Linux inbound-smtp.eu-west-1.amazonaws.com. X.X.XX-XX.XX.amzn1.x86_64 #1 SMP Fri Dec 30 19:11:28 UTC 2016 x86_64
Database Version 5.5.52 Database Collation utf8_general_ci
PHP Version 5.6.28
Web Server Apache/2.4.23 (Amazon) OpenSSL/1.0.1k-fips PHP/5.6.28
WebServer to PHP Interface apache2handler
Joomla! Version Joomla! 3.0.3 Stable [ Ember ] 04-February-2013 14:00 GMT
Joomla! Platform Version Joomla Platform 12.2.0 Stable [ Neil Armstrong ] 21-September-2012 00:00 GMT
User Agent Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36
(i changed some numbers to Xs in the first line).
Related
I have a few servers that fetch images from other sites.
After working for months. Apache started crashing every few hours. (see config at the bottom of the post)
Investigation using logging in the code, shows that sometimes file_get_contents hangs keeping the apache process in W state forever. Sample URL of fetched file that hanged: https://www.mxstore.com.au/assets/thumb/3104041-c.jpg
I have set timeouts in 3 locations and still the Apache process hangs forever
set_time_limit (10);
ini_set('default_socket_timeout',10);
And also in the context (see timeout=>3) :
$opts = array( 'http'=>array('header'=>" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0" ,'timeout'=>3 ) );
$context = stream_context_create($opts);
$data= file_get_contents($product[p_img], false, $context,-1,1500000);
How can I either make timeout work and/or understand why the image is not fetched?
Config:
PHP Version 5.5.9-1ubuntu4.19
Apache/2.4.7 (Ubuntu)
Apache API Version 20120211
Unfortunately all my searches didnt yield a solution. I implemented Curl for the calls.
I have this weird problem, and I don't know how to get rid of it.
Example: I put a var_dump('test') in my code at the top of the page. Just to edit something.
Alt-tab to chrome, cmd-R to refresh.
The var_dump('test')is not there. Cmd-R again. Still not there.
Then I wait for a minute, and refresh... And suddenly it's there.
Basically: I will always see code changes, but not immediately.
I have this problem in PhpStorm and Netbeans, so it's probably not an IDE problem.
Edit: I have also tried this in different browsers, and they all have this as well, so it's not a browser-related problem.
Has anyone had this problem before? Does anyone know a solution to this?
It's really difficult to work efficiently if I have to wait to see my edited code live...
EDIT:
I'm working on my localhost. Server setup is with MAMP.
REQUEST HEADERS:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:nl-NL,nl;q=0.8,en-US;q=0.6,en;q=0.4
Cache-Control:no-cache
Connection:keep-alive
Cookie:projekktorplayertracking_prkusruuid=D1A39803-4DE3-4C0B-B199-6650CF0F8DE5; Akamai_AnalyticsMetrics_clientId=C355983152DF60151A0C6375798CD52E8F09B995; __atuvc=4%7C47%2C0%7C48%2C0%7C49%2C17%7C50%2C47%7C51; PHPSESSID=885c62f543097973d17820dca7b3a526; __utma=172339134.2012691863.1384502289.1387377512.1387442224.41; __utmb=172339134.1.10.1387442224; __utmc=172339134; __utmz=172339134.1384502289.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
Host:local.sos
Pragma:no-cache
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
RESPONSE HEADERS:
Connection:Keep-Alive
Content-Length:681
Content-Type:text/html
Date:Thu, 19 Dec 2013 09:00:54 GMT
Keep-Alive:timeout=5, max=99
Server:Apache/2.2.25 (Unix) mod_ssl/2.2.25 OpenSSL/0.9.8y DAV/2 PHP/5.5.3
X-Pad:avoid browser bug
X-Powered-By:PHP/5.5.3
EDIT:
I was messing around in MAMP's settings. My PHP version was 5.5.3, but then I couldn't set any PHP Extensions.
When I put PHP version on 5.2.17 (my only other option), I was able to set Cache to XCache.
So... Now my page is always up-to-date when reloaded immediately.
Thanks to anyone that replied and helped me with this!
This was the solution:
I was messing around in MAMP's settings. My PHP version was 5.5.3, but then I couldn't set any PHP Extensions.
When I put PHP version on 5.2.17 (my only other option), I was able to set Cache to XCache.
Then it worked.
But then I found this thread.
In your MAMP Dir go to : /bin/php/php5.5.3/conf/php.ini
And comment the Opcahe lines:
[OPcache]
;zend_extension="/Applications/MAMP/bin/php/php5.5.3/lib/php/extensions/no-debug-non-zts-20121212/opcache.so"
; opcache.memory_consumption=128
; opcache.interned_strings_buffer=8
; opcache.max_accelerated_files=4000
; opcache.revalidate_freq=60
; opcache.fast_shutdown=1
; opcache.enable_cli=1
Now I'm programming in PHP 5.5.3, and my pages are immediately updated.
There are three possible causes (I can think of):
Your browser is caching the file, on development sites you can disable your cache (eg in Chrome press F12 and click on the gear in the bottom right, check the checkbox to disable cache while developer tools are open - keep it open in development areas)
Your connection to your server is lagging, this can be caused by delayed uploads by your IDE or by your connection. You can test this by opening a SSH connection and check modified times after saving (eg; repeatedly pressing ls -la or watch -n 1 ls -la in the directory of the file)
In case of some applications another form of caching might exist. This can be APC or Opcache. In order for this to be the possible cause it might be wise to exclude the above first. This step requires you to analyze the headers send by the server as available on the Network tab of the devtools (in case of chrome)
Not sure about NetBeans, but PhpStorm updates the file as you type (there is no need to explicitly save). HOWEVER, the auto-save debounce is OS dependant. Mac might wait for file changes slower to refresh their contents. I'm not sure how to do it on OS X, because I can't recall the name of the feature but another workaround is to explicitly save the file using Command+S.
I had a similar sounding problem working locally with .php and .less files in IE and Chrome. Something was causing the css file to be cached or cookied or something and wouldn't display the changes made to the .less file. We fixed it by creating a php variable of the time stamp and then attaching the variable to the end of the file name and source link. The browser treated it like a new file and would always load it.
I don't have the actual code to do that right now (I'm at home) but will look for it tomorrow at work.
Obviously, this isn't the same problem you're having, but I thought it might give you a new direction to research your issue.
Please consider the below request from apache access log.
119.63.193.131 - - [03/Oct/2013:19:22:19 +0000] "HEAD /blah/blahblah/ HTTP/1.1" 301 - "-" "\"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)\""
Does this request comply with the RFC / standard?
Would Apache pass malformed HEAD requests to PHP?
My configuration is Apache 2.2.15, mod_fcgid 2.3.7, PHP 5.3.3, Linux 2.6.32.60-40 x64, CentOS 6.4
I see nothing obviously wrong about the request in that log entry. It has an unusual user agent (with double quotes in it), but that doesn't make it malformed - it's perfectly valid, and Apache would certainly pass it on to PHP.
I have done fair few RESTful APIs with PHP and apache; never came across any such issues. Best would be to isolate the part that you want to doubly make sure to be working, which in your case is PHP and apache. So put together a basic PHP script that would dump $_SERVER and apache_request_headers() (may be other global variables) which would give you enough clue as to whether it is working or not. use curl -I option for a command line HTTP client; you may also use -v option to see exactly what happens from the client's perspective.
We're having strange behavior on our linux server. Here are some symptoms:
1) PHP using old information when processing scripts:
For example: I loaded up the site today and it ran the mobile version of our Joomla 2.5.9 template instead of the normal template. I looked through the access log and two minutes before I loaded the site up an iPhone had accessed the site. So, for some reason the PHP code ‘thought’ that my access was still the iPhone. Here’s a snip from the access log.
74.45.141.88 - - [01/Mar/2013:07:39:24 -0800] "GET / HTTP/1.1" 200 9771 "https://m.facebook.com" "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B141 [FBAN/FBIOS;FBAV/5.5;FBBV/123337;FBDV/iPhone2,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/6.1;FBSS/1; FBCR/AT&T;FBID/phone;FBLC/en_US;FBOP/0]"
...
63.224.42.234 - - [01/Mar/2013:07:43:45 -0800] "GET / HTTP/1.1" 200 9771 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0"
2) Links on the site are sometimes being generated within Joomla differently: sometimes "ww.sitename.com" or just "sitename.com" when it should be "www.sitename.com".
3) When I make a configuration change to the site (within Joomla administration), it doesn't always take immediately, though it should. For instance, when click publish something using the user interface, it will still be published for quite a while after I unpublished it. During a problem like this, I have tried restarting both Apache and MySQL and it didn't help. I had to wait until something updated. Eventually it does update.
4) The php session doesn't consistently work. We have code that generates a captcha from a session variable. The code fails sometimes rendering the captcha inoperable.
All the above is totally inconsistent. Sometimes it wigs out other times it doesn't. Also, note that the site works totally fine on our dev.sitename.com. We even tried to switch the Apache webserver configuration from our dev.sitename.com to our sitename.com. And the problem still persists.
Thank you.
I had a similar problems with magento CMS in my case the problem was cache used by magento. Disabling the caching functionality had solved the problem.
I have JWplayer installed on my website and would like to record and store the number of views my videos get.
I already have all the javascript and ajax code needed to store data into my database after someone hits play. However I feel that incrementing a number in the database every single time someone plays a video is inefficient.
What would be the best most efficient method to solve this problem?
Thanks.
I asked a similar question several months ago, but it related to ads. I wanted to know the best way to track ad renders so I could bill clients accurately. The response I got was to use access logs. So I ended up writing a parser to extrapolate out all the ads from a server log and import into a table for report viewing.
Something to look out for if you are going to use access logs as the source for tracking this type of information. Logrotate, make sure you are pulling the data out before logrotate overwrites a logfile. I'm not really a systems guy, but I set my logrotate up so that every day at midnight the days log file gets moved to a new location.
Another benefit of access logs is if a client (or anyone) questions your numbers you can refer back to the source log file and demonstrate that your numbers are not inflated.
-- Edit --
Example of access log entry:
# If you can extrapolate videos from your path, then your parser has something to
# hook into (videos in path), and your done
127.0.0.1 - - [08/Dec/2011:22:47:25 +0000] "GET /path/to/your/videos/video1.wmv HTTP/1.0" 200 57530 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"
# Or, you could append a flag to the video url, and have your parser hook into the flag
# for this example 'videoPlayed'
127.0.0.1 - - [08/Dec/2011:22:47:25 +0000] "GET /path/to/your/videos/video1.wmv?videoPlayed=1 HTTP/1.0" 200 57530 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2"