Page 2 of 2

Re: problems with compression gzip .htaccess performance

Posted: Sun Aug 06, 2017 2:39 pm
by ideep13
php5ini_back file was in the opencart when I installed it. I created another php.ini file.

This is the code in it:

Code: Select all

; cPanel-generated php ini directives, do not edit
; Manual editing of this file may result in unexpected behavior.
; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
; For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)

magic_quotes_gpc = Off;
register_globals = Off;
default_charset	= UTF-8;
memory_limit = 256M
max_execution_time = 90
upload_max_filesize = 999M
safe_mode = Off;
mysql.connect_timeout = 20;
session.use_cookies = On;
session.use_trans_sid = Off;
session.gc_maxlifetime = 1440
allow_url_fopen = On
allow_url_include = Off
asp_tags = Off
display_errors = On
enable_dl = On
file_uploads = On
max_input_time = 90
max_input_vars = 1000
session.save_path = "/tmp"
and this is in php.ini_back file.. these files are all under public_html where the store is

Code: Select all

magic_quotes_gpc = Off;
register_globals = Off;
default_charset	= UTF-8;
memory_limit = 256M;
max_execution_time = 36000;
upload_max_filesize = 999M;
safe_mode = Off;
mysql.connect_timeout = 20;
session.auto_start = Off;
session.use_only_cookies = On;
session.use_cookies = On;
session.use_trans_sid = Off;
session.cookie_httponly = On;
session.gc_maxlifetime = 3600;
allow_url_fopen = on;
;display_errors = 1;
;error_reporting = E_ALL;
if I uncomment or comment # the last part of the code in .htaccess nothing works.. it still doesn't work.. I can not edit system preference .. for example compression from 4 to 6

now my site is down.. I'm working on this for three days day and night and nothing WORKS!
This site can’t be reached

djecje-kucice.com took too long to respond.
ERR_CONNECTION_TIMED_OUT

Re: problems with compression gzip .htaccess performance

Posted: Sun Aug 06, 2017 3:32 pm
by ideep13
Hello,

We're highly not recommend you utilize php.ini file under your installation? in order to avoid any software conflicts

You may manage PHP parameters via PHP selector and '.htaccess' file <p>&nbsp;</p>
well this is unbelievable .. nothing can be done so it's better for me to delete the whole site, because I can't change anything in the dasboard under sytem preferneces - server

Re: problems with compression gzip .htaccess performance

Posted: Sun Aug 06, 2017 5:59 pm
by ideep13
only ifI disable .htaccess and change it to htaccess.txt I can enter into dashboard and edit system

than after I change the compression to 6, I changed the file back to .htaccess

this is the code in .htaccess

Code: Select all

# Rabbit Rabbit Security Upgrade, enhanced by Ernie 03/30/2017
<Files .htaccess>
order allow,deny
deny from all
</Files>

LimitRequestBody 750000

Options +SymLinksIfOwnerMatch

# Prevent Directory listing 
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "(?i)((^\.|\.xml|\.txt|\.tpl|\.ini|\.log|(?<!robots)\.txt))">
Order deny,allow
Deny from all
</FilesMatch> 

# disable etags
FileETag none

# SEO URL Settings
RewriteEngine On

# If your opencart installation does not run on the main web folder,
# make sure you folder it does run in ie. / becomes /shop/

RewriteBase /

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*) https://djecje-kucice.com%{REQUEST_URI} [R=301,L,NE]
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule .* ? [F,L]
# Enable Gzip Compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_include mime ^text/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_include handler ^cgi-script$
</ifModule>
# gzip end #

# Leverage Browser Caching
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 1 month"
</IfModule>

<IfModule mod_security.c>
 SecFilterEngine On
 SecFilterScanPOST On
</IfModule>

### Additional Settings that may need to be enabled for some servers
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200

# 7. disable open_basedir limitations
# php_admin_value open_basedir none

 ???  :(

Re: problems with compression gzip .htaccess performance

Posted: Mon Aug 07, 2017 8:18 am
by MrPhil
ideep13 wrote:
Sun Aug 06, 2017 5:59 pm
only ifI disable .htaccess and change it to htaccess.txt I can enter into dashboard and edit system
That tells me that there is still something wrong in your .htaccess. When you say "dashboard", I take it you're talking about the OpenCart dashboard and not your hosting control panel? A hosting control panel should never be broken by something in .htaccess.
than after I change the compression to 6, I changed the file back to .htaccess
Does it work then, or is it still broken? Your home page seems to come up OK for me. Don't forget, after making a change, to force your browser to load a fresh copy of the page by either clearing your browser cache, or using Ctrl-F5. Is everything working again except that compression/gzip isn't where you want it to be? You could try commenting out ( # ) all the sections in .htaccess concerning gzip and DEFLATE, and see if the site at least is working properly. Then try uncommenting section by section the gzip and DEFLATE stuff, until you find the problem.

I'm a bit concerned that you've got both DEFLATE and mod_gzip enabled in there. Possibly they are interacting in some strange way? You may end up having to use one or the other. You mention setting compression to "6" -- is that in .htaccess, OC dashboard, or in your hosting control panel? Again, you may be seeing some bad interaction between .htaccess compression settings and your control panel's or dashboard's compression settings (if any). Also note that mod_security has been known to do strange things to applications with complicated URI Query Strings, so you might want to comment out that section and see if anything improves. Start with a simple, clean, working setup; and then add in new settings (like compression) one at a time until something breaks. I suspect that you're adding settings that don't play nice together. Just because they're available doesn't mean they work together.

I would suggest that you add some comments to explain what's going on, so you'll remember it next time:

Code: Select all

# force https if not present, and remove www. if used in domain name
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^(.*)$ https://djecje-kucice.com/$1 [R=301,L,NE]

# some special redirection
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]

# SEO: if it's not a real file or directory, and not certain images and auxiliary files, feed it to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

# block libwww-perl-based user agents (?)
RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule .* ? [F,L]

Re: problems with compression gzip .htaccess performance

Posted: Mon Aug 07, 2017 6:59 pm
by ideep13
MrPhil wrote:
Mon Aug 07, 2017 8:18 am
ideep13 wrote:
Sun Aug 06, 2017 5:59 pm
only ifI disable .htaccess and change it to htaccess.txt I can enter into dashboard and edit system
That tells me that there is still something wrong in your .htaccess. When you say "dashboard", I take it you're talking about the OpenCart dashboard and not your hosting control panel? A hosting control panel should never be broken by something in .htaccess.[/code]

OPENCART dashboard
than after I change the compression to 6, I changed the file back to .htaccess
Does it work then, or is it still broken? [/code]

What do you mean? this is teh setting in system openacrt dashboard.. i checked if anything happens under gtmetrix.. but nothing happens..

i am tyelling you that if I have that code in .htacess I can NOT EDIT DASHBOARD.. in order to do that I nered to change .htaccess to htacess.txt so I can GET IN THE DASHBOARD

Code: Select all

Your home page seems to come up OK for me.[/b] Don't forget, after making a change, to force your browser to load a fresh copy of the page by either clearing your browser cache, or using Ctrl-F5. Is everything working again except that compression/gzip isn't where you want it to be? You could try commenting out ( # ) all the sections in .htaccess concerning gzip and DEFLATE, and see if the site at least is working properly. Then try uncommenting section by section the gzip and DEFLATE stuff, until you find the problem.
THE MAIN PROBLEMS ARE TWO:
1. I CAN NOT GET INTO THE DASHBOARD until I rename the name of the htaccess file
2. POOR PERFORMANCE ON GTMETRIX.. I am also working on the code in htaccess so I can improve the performance in GTMETRIX.. but in GTMETRIX report tha GZIP is clearly RED.. so something is wrong..

Code: Select all

I'm a bit concerned that you've got both DEFLATE and mod_gzip enabled in there. Possibly they are interacting in some strange way? You may end up having to use one or the other. You mention setting compression to "6" -- is that in .htaccess, OC dashboard, or in your hosting control panel? Again, you may be seeing some bad interaction between .htaccess compression settings and your control panel's or dashboard's compression settings (if any). Also note that mod_security has been known to do strange things to applications with complicated URI Query Strings, so you might want to comment out that section and see if anything improves. Start with a simple, clean, working setup; and then add in new settings (like compression) one at a time until something breaks. I suspect that you're adding settings that don't play nice together. Just because they're available doesn't mean they work together.
Under CPANEL I have the option under SOFTWARE -> Optimize Website -->
Compress Content
Apache allows you to compress content before sending it to the visitor’s browser. The types of content to be compressed are specified by MIME type. This feature requires Apache’s mod_deflate to function correctly.

Disabled
Compress All Content
Compress the specified MIME types.
I have the third one option selected.. But even if I disable nothing changes .. I still can't get into the OPENCART dasboard (I think this has nothing to do with entering dashboard) nor do I have better result in performace

I also told you that I uncomment ONE BY ONE, ALL, OR NEITHER.. I still can't get in.. I don't get any error505 I just can't change anything under system setting in OC (i get 404 error)

Code: Select all

### Additional Settings that may need to be enabled for some servers
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
#php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
#php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
#php_value max_execution_time 200

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
#php_value max_input_time 200

# 7. disable open_basedir limitations
#php_admin_value open_basedir none

EDIT., I found out the error causing not entering the dashboard

Code: Select all

<IfModule mod_security.c>
 SecFilterEngine On
 SecFilterScanPOST On
</IfModule>
This was causing the error.

But now, I still have the red flag under gzip gtmetrix report!

I at least moved up a little bit.. now I have speed 62% D, but Yslow is still F

I am sure If I could enable gzip somehow I would have at least B!

Re: problems with compression gzip .htaccess performance

Posted: Mon Aug 07, 2017 9:27 pm
by MrPhil
OK, so now all your store and admin capability is working properly? The only problem is that gtmetrix is reporting that you're very slow? Have you tried other performance ratings, such as from Google? Maybe gtmetrix has a very poor and slow connection to your server, for some reason. Just browsing your site, does it seem as fast as any other estore site, or is it noticeable in its slowness?

Just be careful to try one thing at a time, whether it's directly editing .htaccess, or using your hosting control panel, or something in the OC dashboard. If you try mixing several different compression methods at once, that might cause problems. All I can suggest is to try one at a time until you find the best performer that doesn't break any function. If that's not enough, you can try adding a second method, but don't be surprised if that breaks something (or has a bad interaction with the first method) and you have to back it out.

Re: problems with compression gzip .htaccess performance

Posted: Wed Aug 09, 2017 5:22 pm
by ideep13
MrPhil wrote:
Mon Aug 07, 2017 9:27 pm
OK, so now all your store and admin capability is working properly? The only problem is that gtmetrix is reporting that you're very slow? Have you tried other performance ratings, such as from Google? Maybe gtmetrix has a very poor and slow connection to your server, for some reason. Just browsing your site, does it seem as fast as any other estore site, or is it noticeable in its slowness?[/code]

Yes, I tried other preformance ratings websites, but the results are catastrophic. All sites are saying no gzip, enable gzip..

My product images now changed overnight.. they shrinked somehow.. I don't know why.. And now it looks ugly.
I never touched image setting in OC dashboard.. so it is probably the fault in .htaccess..

I am clueless on what to do regarding getting my images back like it was.. and getting my performance and gzip finally working..

???

Re: problems with compression gzip .htaccess performance

Posted: Thu Aug 10, 2017 12:43 am
by MrPhil
Your images look full-sized to me. Every time you change something, do you force a page refresh (usually Ctrl+F5) to make sure you're getting the absolute latest version? Is the text reduced in size, too? I've heard of people accidentally setting the "zoom" (scale) on their browser to other than 100% -- make sure you didn't do that (unless you have poor eyesight and need all pages zoomed in)!

Your pages do seem rather slow to load. I see you have a lot of slides loading... maybe that's part of the problem. Can you temporarily turn off your slide shows and see if performance greatly improves? Also make sure your images (including slides) are not of wildly huge size (e.g., 1024x768) and letting the browser scale them down (say, to 133x100). That wastes a lot of bandwidth to move huge image files and then scale them down.

As I said before, try only one compression method at a time (gzip, FLATE, etc.), as they may interact badly with one another. Your host should be able to tell you how to best implement something like gzip on your server, so make sure you've asked them.

Re: problems with compression gzip .htaccess performance

Posted: Thu Aug 10, 2017 2:00 am
by ideep13
MrPhil wrote:
Thu Aug 10, 2017 12:43 am
Your images look full-sized to me. Every time you change something, do you force a page refresh (usually Ctrl+F5) to make sure you're getting the absolute latest version? Is the text reduced in size, too? I've heard of people accidentally setting the "zoom" (scale) on their browser to other than 100% -- make sure you didn't do that (unless you have poor eyesight and need all pages zoomed in)!

Your pages do seem rather slow to load. I see you have a lot of slides loading... maybe that's part of the problem. Can you temporarily turn off your slide shows and see if performance greatly improves? Also make sure your images (including slides) are not of wildly huge size (e.g., 1024x768) and letting the browser scale them down (say, to 133x100). That wastes a lot of bandwidth to move huge image files and then scale them down.

As I said before, try only one compression method at a time (gzip, FLATE, etc.), as they may interact badly with one another. Your host should be able to tell you how to best implement something like gzip on your server, so make sure you've asked them.
no nothing happens if I turn off the slider... the page is still slow..

the host doesn't know s****

Could you please check my cpanel and php setting.. as well the ini file and .htaccess.. maybe is something wrong there.. I really don't know how to fix this.. I am asking you for help, please - I can bet this will take you 5 minutes to solve

Re: problems with compression gzip .htaccess performance

Posted: Thu Aug 10, 2017 9:52 pm
by MrPhil
Here is part of your .htaccess that you posted a few days ago:

Code: Select all

# Enable Gzip Compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_include mime ^text/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_include handler ^cgi-script$
</ifModule>
# gzip end #
As I said several times, turn OFF all your compression (comment out with # these entries) and then try one at a time. Try your hosting control panel "optimize your site by compressing pages" and see if that has any effect. If not, turn it OFF and uncomment (enable) the AddOutputFilterByType section and try that. You might also try combining them into one entry:

Code: Select all

AddOutputFilterByType DEFLATE text/text text/plain text/html text/xml text/css application/xml application/xhtml+xml application/rss+xml application/javascript application/x-javascript
It that doesn't help, comment it back out and try uncommenting the mod_gzip_item_* lines. I'm not familiar with gzip, so I can't help much, other than to say you might have to change ifModule to IfModule (capital I). If that doesn't help, I've seen the following:

Code: Select all

<FilesMatch "\.(html|css|js|xml)$">
SetOutputFilter DEFLATE
</Files>
If you have other text (non-binary) files that are being sent, you can add their extensions to the FilesMatch list. I'm not sure you need to put .php in the list, but you can try it if you wish. Just be careful that you don't end up sending your PHP files to the browser.

If none of these work (tried one at a time), then I'm out of ideas. If you can't find someone locally who can look over your shoulder and help you, you may need to change hosts. It sounds like these guys have a very back-level system and poor customer help.

Re: problems with compression gzip .htaccess performance

Posted: Sun Aug 13, 2017 6:28 am
by ideep13
I moved to another host
They said that there is not a problem in hosting but in 300 + HTTP requests.. please see the picture--

but after running a test again in gtmetrix.. gzip is not enabled..

I'm loosing my mind. What can I do now? I read somewhere that is better move images,js. and css to a subdomain..? how to implement cdn? I have a google cdn in mind.. not max cdn.. how does this work??

Re: problems with compression gzip .htaccess performance

Posted: Sun Aug 13, 2017 9:41 am
by IP_CAM
Well, this looks more like a download Page, with 311 Requests
and just about 5MByte Data Download, it's far beyond recommended spec's. :'(
But GTMetrix tells you loud and clear, where you still have some improvent.
Good Luck, you'll need it! ;)
Ernie

Re: problems with compression gzip .htaccess performance

Posted: Sun Aug 13, 2017 4:56 pm
by ideep13
IP_CAM wrote:
Sun Aug 13, 2017 9:41 am
Well, this looks more like a download Page, with 311 Requests
and just about 5MByte Data Download, it's far beyond recommended spec's. :'(
But GTMetrix tells you loud and clear, where you still have some improvent.
Good Luck, you'll need it! ;)
Ernie
After transferring my site to another host I can't login into admin panel
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@djecje-kucice.com to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
As you can see I'm bothering with this with two weeks, why nobody wants to help me? Please help me get into admin panel again

Re: problems with compression gzip .htaccess performance

Posted: Mon Aug 14, 2017 8:27 pm
by MrPhil
If you moved to a new host, and suddenly you're getting 500 (Internal Server) errors, the first place to look is in your .htaccess and (if any) php.ini files. You might have settings in there which are not allowed on your new system. Common cases are php_value, php_flag, and Options commands in .htaccess. PHP settings usually need to be moved to a php.ini file (or equivalent -- ask your new host what to do). Many .htaccess files have Options -Indexes or similar, and if disallowed, you need to do something else, such as putting an empty index.html file in directories that do not otherwise have an index.* file (ask your host what they suggest).

If that doesn't fix it, it's possible that file(s) were corrupted during the move, leading to blank or empty lines before the opening <?php or after the closing ?> tags. Did you edit any files during the move? You could check that and edit out the empty lines.