cURL error | Unable to download fonts
-
Hi,
I am having trouble downloading the fonts locally. I want to preload my all google fonts.
Whenever I am clicking on “download”, this error pops up
“cURL error 28: Resolving timed out after 5000 milliseconds”
I am attaching a screenshot for your reference.
Screenshot 1 – https://ibb.co/WHHppSz
Screenshot 2 – https://ibb.co/WcJv7KzThis error also pops up when I am trying to go from the “Advanced Settings” tab to “Generate Stylesheet” tab.
My Website is https://questionpapershub.com/home/
-
Yes Yes, thank you so much for all your replies, I will try googling, and will update you by tomorrow the results.
Thank You again.
-
This reply was modified 4 years, 10 months ago by
qph9697.
Awesome! I look forward to your findings!
You could try setting this in your server’s PHP configuration: try setting default_socket_timeout to 10 seconds, for example.
Hi, I did what you said.
On google, I got to know that, this can be changed using either .htaaccess or php.ini file,
First I tried, .htaaccess file, the code I wrote was
php_value default_socket_timeout 10
in the .htaaccess fileSecond, I tried with php.ini, since there was no such file,
and according to this site – https://www.hostgator.com/help/article/what-is-php-ini
I created one, and the code I wrote was,<?php ini_set("default_socket_timeout", 10);
Both of them didn’t work, I am still getting the same issue.
<?php ini_set("default_socket_timeout", 10);
This code I found on
https://tideways.com/profiler/blog/using-http-client-timeouts-in-php and
https://stackoverflow.com/questions/11682207/can-i-change-default-socket-timeout-from-my-php-code-
This reply was modified 4 years, 10 months ago by
qph9697.
@qph9697 where did you put your PHP code?
Are you hosting with Hostgator? Your hosting provider may be allowing different things, so it’s best to get their help, because they know their environment best.
However, changing the cURL timeout value, whichever way you do it, affects everything that uses cURL, and provides a crude workaround.
As a possible solution, try doing this:
- Remove italic styles – I’ve found italics works OK without them (at least on Chrome), but test to make sure
- Remove font weights you don’t actually use – look through your CSS and leave only font weight styles included in active styles
- Uncheck “preload” for font styles you don’t need to preload, and only check it for fonts you use above the fold – again, check your CSS and use the code inspector to find the minimum set
Hi,
I don’t know how, but the error was gone & now I am able to download the fonts and preload them. (due to this Google page speed doesn’t show the preload check for fonts)
But, there’s one issue, everything is working fine, but when I did my page speed check on GtMetrix and Google Page Speed, the loading time & the number of requests had increased.
I just downloaded the fonts, preloaded all styles, and generated the stylesheet.
(approx 10 requests are added when I activate the plugin)Can you please help me with this.
And one more thing, you all are wonderful and thank you for all your help.
-
This reply was modified 4 years, 10 months ago by
qph9697.
So it was a server issue. Coincidentally the API responded fast enough now.
About your current issue: do you have remove Google Fonts checked in the Advanced Settings?
So it was a server issue. Coincidentally the API responded fast enough now.
Yes, it might have been, but for info, this issue happened when I was using Cloudflare CDN. And yesterday only I changed back my nameserver to the default(GoDaddy), and today when I tried again, the error was gone. (For info, Cloudflare CDN increased load time, which affected my site SEO, which is why I changed to default)
do you have remove Google Fonts checked in the Advanced Settings?
The “remove google fonts” is unchecked in the advance settings tab.
For Info
I again tested my page, by preloading, downloading the font & generating the style sheet.
My GTMetrix report before was 3.1sec 51 Requests and after downloading fonts it is 5.0sec 64 Requests.-
This reply was modified 4 years, 10 months ago by
qph9697.
Yes, well, remove Google Fonts should be checked ??
Yes, well, remove Google Fonts should be checked
Yes did this, and it decreased my load time & my requests too. Thank You for the info.
But,
I was trying to solve one more issue from my google page speed test,Ensure text remains visible during Webfont load
I searched for this & found that
changing the “Font-display option” in the advanced setting from “Auto” to “Swap” will do the trick.But there were no changes in my test, instead, it increased my load time.
Am I wrong somewhere?
Thank You once again & your plugin is wonderful, Sir.
Am I wrong somewhere?
Please refer to my reply above.
Also, you should check the browser caching settings on your site (in .htaccess) support font caching (and other static resources). This may not help the first page load, but it will make subsequent page loads faster.
Remove italic styles – I’ve found italics works OK without them (at least on Chrome), but test to make sure
Remove font weights you don’t actually use – look through your CSS and leave only font-weight styles included in active styles
Uncheck “preload” for font styles you don’t need to preload, and only check it for fonts you use above the fold – again, check your CSS and use the code inspector to find the minimum setYes, I did remove the italics and unnecessary font styles and brought it down from 18 to 5 font styles with 2 subsets. And due to this, my site speed improved a lot.
But I wanted to remove the issue given below from the google page speed test,
Ensure text remains visible during Webfont load
as it is consuming a couple of seconds.
I did try the “swap” method but didn’t work as I had written before.
Also, you should check the browser caching settings on your site (in .htaccess) support font caching (and other static resources).
I looked into my .htaccess file and the font caching code is there.
I found this code in my .htaccess fileAddType application/vnd.ms-fontobject .eot AddType application/x-font-ttf .ttffo AddType application/x-font-opentype .otf AddType application/x-font-woff .woff AddType image/svg+xml .svg
This may not help the first-page load, but it will make subsequent page loads faster.
And I am testing the page speed for my “interior pages”.
If it helps, this is my page link
https://questionpapershub.com/home/free-job-alert/So first, there’s an error on your page:
Uncaught ReferenceError: jQuery is not defined at (index):3 (anonymous) @ (index):3
Now, it seems like you have good
mod_expires
rules, too, because fonts expire after 1 year. If you look again at your .htaccess, you’ll see them.When I looked at the Google PageSpeed Insights test for your site, the main problem in the first round was server response time.
The second time around, there were two fonts listed with the recommendation to preconnect, but they weren’t loaded by OMGF. One is GeneratePress, mentioned in inline CSS (WHAT?), and the other was FontAwesome, loaded by the Contact Widgets plugin.
Further down, it lists your font with a recommendation to set “font-display” to “swap”, because your CSS has them all set to “auto”. This should be an easy switch.
Did you purge your CSS cache after setting OMGF to “swap”?
This should be an easy switch.
Yes, I did the switch from “auto” to “swap”, but no effect, the issue is still there.
Did you purge your CSS cache after setting OMGF to “swap”?
I did “Purge All Cache” using w3tc plugin.
Just now I found another issue on mobile,
An issue with the “remove google fonts” option.When “remove google font” is TICKED, my complete font-weight changes on ONLY Mobile(No Change on Desktop).
But when I untick “remove google font”, it gets back to the original state, which I had designed it for.I have attached screenshots for your reference, please go through them,
When “remove google font” TICKED https://ibb.co/HD39v2P
When “remove google font” UNTICKED https://ibb.co/NjcHZWpWhy is this issue arising? Please help me with this, why is everything getting “bold” after TICKING “remove google font”.
My Page is https://questionpapershub.com/home/free-job-alert/
Please make sure that ‘Also optimize for logged in users?’ under OMGF’s advanced settings is checked, while debugging.
Please make sure that ‘Also optimize for logged in users?’ under OMGF’s advanced settings is checked, while debugging.
Yes, I will remember this.
But the issue is still the same,
If “remove google fonts” is ticked, everything is seen as “bold” in mobile.What should I do, so that my original font-weight is used?
-
This reply was modified 4 years, 10 months ago by
- The topic ‘cURL error | Unable to download fonts’ is closed to new replies.