About server environment optimization. (I need advice with the relevant OpenCart)

Hello!

I have two OpenCart systems, And completed the move of the host environment two days ago.

Although I have studied many server settings, But I still need the master to help me confirm whether there are any items that need to be changed in my settings.

Because I still seem to encounter some problems in the checkout process, I need you to provide me with some valuable suggestions, I hope you guys can help me solve my problem.

Current host environment:
Linode hosting plan:
Dedicated 16 GB

Operating system:
Ubuntu 18.04 LTS

Web Hosting Control Panel:
CyberPanel Enterprise (CyberPanel + LiteSpeed Enterprise)

Web Server:
LiteSpeed V7.9

php Version:
PHP Version 7.3.30-1+bionic

Database version:
10.1.48-MariaDB-0ubuntu0.18.04.1-Ubuntu 18.04

Currently modified php.ini settings:
short_open_tag = On
max_execution_time = 3600
max_input_time = 400
memory_limit = 2048M
post_max_size = 800M
file_uploads = On
upload_max_filesize = 2000M
default_socket_timeout = 60
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = On
date.timezone = Asia/Taipei
session.cookie_secure = 1
session.cookie_samesite="None"
session.cookie_path = "/; samesite=none"
session.cookie_httponly = 1
xmlrpc_errors = 0
xmlrpc_error_number = 0

php extension:
imagick.so
mcrypt.so
bz2.so
fileinfo.so
zip.so

OpenCart environment:
OpenCart 2.3.0.2 + Journal 2.16.8
OpenCart 3.0.3.7 + Journal 3.1.5

Excuse me, Is the current setting of an environment like mine correct?

Because I plan to use the LiteSpeed Cache module, Someone told me that if I want to create a LiteSpeed cache, I have to adjust "max_execution_time = 3600", So I also follow his setting.

But other settings come from Google and related articles, Can someone tell me what to do next?

Thank you!

3 Replies

Because I plan to use the LiteSpeed Cache module, Someone told me that if I want to create a LiteSpeed cache, I have to adjust "max_execution_time = 3600", So I also follow his setting.

max_execution_time is the time allowed for PHP to run your script. If your script takes longer than this, PHP will kill it with an error. Six minutes is a pretty long time…

Although I don't know for sure, the LiteSpeed Cache module is a caching scheme for the web server. PHP has it's own caching scheme. Ideally, an incoming request would get satisfied by the Lightspeed cache before the server even bothered PHP.

After that, the PHP caching scheme would kick in (although according to your posted configuration, you haven't enabled a PHP cache).

So, after all that, I think "someone" didn't know what he was talking about and that max_execution_time should be way shorter…in the neighborhood of 30 to 60 sec. You may need to increase it slightly if you implement PHP caching…but nowhere near 6 minutes!

I'm assuming you're going to test all this before it goes live. That's the time to determine what all this should be.

default_socket_timeout = 60

I'm assuming that there's no embedded PHP module in Lightspeed like there is with Apache so you're using php-fpm. Make sure PHP and Lightspeed communicate with a local-domain socket. Not only are local-domain sockets faster because they short-circuit the network stack but they're also secure because traffic can never "leak" outside the system. If you're using local-domain sockets, 60 seconds is a pretty high value for a timeout. The right value for you will be determined by testing.

-- sw

Thanks for your reply!

Because it takes a lot of time to create "LiteSpeed Cache", My previous experience, when I created the page cache of the product, I did find that the script was frozen, That's why I set "max_execution_time = 3600", maybe when I complete this operation, I will set it to the default value.

But I have a more serious problem now, my payment gateway module seems to have a timeout problem, How can i solve this problem?

httpWebRequest.Timeout:10000
httpWebRequest.ReadWriteTimeout:10000
傳送網址:https://www.xxx.tw/index.php?route=extension/payment/ecpaypayment/response
MerhcantID:
ReferenceKey:
傳送參數:AlipayID=&AlipayTradeNo=&amount=460&ATMAccBank=&ATMAccNo=&auth_code=157910&card4no=3302&card6no=469587&CustomField1=&CustomField2=&CustomField3=&CustomField4=&eci=0&ExecTimes=&Frequency=&gwsr=67097769&MerchantID=3003283&MerchantTradeNo=102098&PayFrom=&PaymentDate=2021/09/13 15:18:11&PaymentNo=&PaymentType=Credit_CreditCard&PaymentTypeChargeFee=11&PeriodAmount=&PeriodType=&process_date=2021/09/13 15:18:11&red_dan=0&red_de_amt=0&red_ok_amt=0&red_yet=0&RtnCode=1&RtnMsg=交易成功&SimulatePaid=0&staed=0&stage=0&stast=0&StoreID=&TenpayTradeNo=&TotalSuccessAmount=&TotalSuccessTimes=&TradeAmt=460&TradeDate=2021/09/13 15:16:26&TradeNo=2109131516261954&WebATMAccBank=&WebATMAccNo=&WebATMBankName=&CheckMacValue=E1424558A573B830C0E3B1D2A5778BB46CA63609E0E97ACDAD28EFE8C37B24BC
傳送開始時間:2021-09-13 15:18:13:6103
傳送結果:0|Error: (0)
傳送結束時間:2021-09-13 15:18:16:5858
RealIP:10.5.3.5
log建立時間:2021-09-13 15:18:16:5858

httpWebRequest.Timeout:10000
httpWebRequest.ReadWriteTimeout:10000
傳送網址:https://www.xxx.tw/index.php?route=extension/payment/ecpaypayment/response
MerhcantID:
ReferenceKey:
傳送參數:AlipayID=&AlipayTradeNo=&amount=460&ATMAccBank=&ATMAccNo=&auth_code=157910&card4no=3302&card6no=469587&CustomField1=&CustomField2=&CustomField3=&CustomField4=&eci=0&ExecTimes=&Frequency=&gwsr=67097769&MerchantID=3003283&MerchantTradeNo=102098&PayFrom=&PaymentDate=2021/09/13 15:18:11&PaymentNo=&PaymentType=Credit_CreditCard&PaymentTypeChargeFee=11&PeriodAmount=&PeriodType=&process_date=2021/09/13 15:18:11&red_dan=0&red_de_amt=0&red_ok_amt=0&red_yet=0&RtnCode=1&RtnMsg=交易成功&SimulatePaid=0&staed=0&stage=0&stast=0&StoreID=&TenpayTradeNo=&TotalSuccessAmount=&TotalSuccessTimes=&TradeAmt=460&TradeDate=2021/09/13 15:16:26&TradeNo=2109131516261954&WebATMAccBank=&WebATMAccNo=&WebATMBankName=&CheckMacValue=E1424558A573B830C0E3B1D2A5778BB46CA63609E0E97ACDAD28EFE8C37B24BC
傳送開始時間:2021-09-13 15:18:13:6103
傳送結果:0|Error: (0)
傳送結束時間:2021-09-13 15:18:16:5858
RealIP:10.5.3.5
log建立時間:2021-09-13 15:18:16:5858

I found that the two php.ini settings may be solved, can you help me confirm?

; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; http://php.net/max-input-time
max_input_time = -1

; How many GET/POST/COOKIE input variables may be accepted
max_input_vars = 2000

Thank you!

; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; http://php.net/max-input-time
max_input_time = -1

It's not a good idea set this to unlimited in any circumstance. If the PHP interpreter is taking too long to parse the script, you want the web server to throw an error. This indicates that there's a problem with the script. If you set this to unlimited your web server will just hang.

; How many GET/POST/COOKIE input variables may be accepted
max_input_vars = 2000

This seems like enough to me.

In your example,

AlipayID=&AlipayTradeNo=&amount=460&ATMAccBank=&ATMAccNo=&auth_code=157910

these are GET variables. POST variables are roughly equivalent to fields in a form. I can't even imagine 2000 fields in a form!

As for your payment gateway problems, I'm afraid you're on your own. Sorry…

-- sw

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct