opencart display_errors on, error_reporting = E_ALL - opencart

Opencart 3.0.2 with php.ini settings:
display_errors = 1;
error_reporting = E_ALL;
sometimes when the site is very busy, the browser display errors like database not found or something similar like:
public_html/system/library/db.php(31): DB\MySQLi->__construct('localhost', 'databaseuser', 'dbpassword', 'databasename', '3306')
for safety reasons should be enough to deactivate display_errors and error_reporting from my server to avoid displaying this data in the users browser or need to take additional action?

display_errors is for errors displayed openly on your website. You should set it to "off" such as: display_errors = Off;
error_reporting is used for you to keep track of errors in your log files instead. Some administrators like to leave this on in case they want to monitor any issues. So this setting can stay as: error_reporting = E_ALL;
However, if you wish to turn it off, you can set it instead to: error_reporting(0);
There are some more advanced settings/techniques for these items. However, for your purpose, this should be enough.

Related

WordPress warning: preg_match(): Compilation failed: nothing to repeat at offset 1

Suddenly my friend's WordPress based website started showing up this warning on subpages:
Warning: preg_match(): Compilation failed: nothing to repeat at offset
1 in /wp-includes/class-wp.php on line 218
Lines 218/219 that are returned in the warning are as follows:
if ( preg_match("#^$match#", $request_match, $matches) ||
preg_match("#^$match#", urldecode($request_match), $matches) ) {
Seems like the code is responsible for URL reworking.
Any ideas what could possibly be going wrong?
The error does not appear on the homepage but on sub-pages. Thus, I guess the permalinks structure is corrupt. An often suggested fix goes like this:
temporary disable all your plugins! Do not skip this step.
go to the WordPress admin dashboard: Settings -> Permalinks
note what you have in the custom permalinks field somewhere else
temporary switch to default permalinks. Save settings.
check the page in question: are the preg_match errors gone?
switch back to your previous custom permalinks setting
re-enable back all the plugins, the pages should be back to normal.
I had this very same issue and it was driving me crazy!
It was a simple fix for me, hopefully will be for anyone else who has the same issue!
All I had to do was login to the backend of the site with /wp-admin and then go to Settings > Permalinks and then set it to 'Post Name' and then click 'Save Changes'. Hard refresh the page/s you had the issue on and it might just be resolved.

How many option values can be in option in Opencart

I am using Opencart 1.5.6.4. I stuck on strange issue. Lemme tell you about that a bit.
I added 16 options in the option tab without option values and when I tried adding the 17th option in the option tab it didn't let me do so. I deleted one and then tried with other and it is added successfully. In short i can't add more than 16 options in option tab in product page.
So my first question is that -> what I assuming is it true as i can't add the 17th option here.
Also Inside product in option tab under how many values can i can define for one option.
My question is that is there any limitation in the number of option values for option? If yes then how many, and can increase it?
There is no limitation on options or option values in Opencart. In all likelihood you are hitting a limit on the php post_max_size directive. Depending on your server configuration you might be able to increase it in a local php.ini file, in .htaccess, or if not contact your server admin and ask them to do so.
I added these lines to my php.ini file in the root & admin folder and the problem is solved!
max_input_vars = 50000;
suhosin.post.max_vars = 10000;
suhosin.request.max_vars = 10000;
max_input_nesting_level = 256;
upload_max_filesize = 256M;
max_input_time = 60;

opencart: I can edit order but cannot delete it. (with Error log)

I use opencart version 2.1.0.1
Everytime I click admin > sales > order, it will pop up "error undefined." By closing that popup window, I can still edit order but cannot delete order (no response).
In my log, there is:
PHP Notice: Undefined variable: order_id in
/var/www/html/opencart2101/system/storage/modification/admin/view/template/sale/order_list.tpl on line 821
The line 821 is:
url: 'index.php?route=extension/openbay/addorderinfo&token=<?php echo $token; ?>&order_id=<?php echo $order_id; ?>&status_id=' + status_id,
However, I haven't installed any openbay related module. Also, line 821 is inside <!-- --> mark. It should have no effect.
Help!
Although this is now an older version of opencart, I still see this being reported a lot around and about.
The problem occurs due to the store front adding the http url rather than the https url to the order. So firstly you need to fix that. If you dont want to read all of my explanation, you can just hit up the bold points :)
Either way BACKUP EVERYTHING actually not really, back up the file you are going to edit and backup your whole database.
open:
catalog/controller/checkout/confirm.php at around line 100
Find:
$order_data['store_url'] = HTTP_SERVER;
Change to:
$order_data['store_url'] = HTTPS_SERVER;
Now you will want to fix your database because for reasons I cannot fathom, the domain name is placed in the order along with the stores id. and when editing orders it is the usage of that directly within your admin order page that throws up the undefined notice. Basically the browser blocks the request because its trying to make an insecure request from a secure page.
Crack open phpmyadmin or whatever database tool you have on hand.
locate the table, default is oc_orders
Browsing the table, look for the column that contains your store url (i cant remember the name off hand, i think its just store_url but it will be obvious anyway. if you are multi store you will need to run the query for each
I am sure somebody can come up with a clever way to automatically convert just the http into https with a single use sql query on the one column, but this works for me.
Run SQL: adjust as appropriate
UPDATE `oc_orders` SET `store_url` = 'https://example.com' WHERE store_id = 0;

Cpanel overwrites amazon SES entries in exim.conf

I need to add some additional configurations on my exim.conf file. But it will get overwrited after some time automatically. I read in some other forum to add entries via exim configuration editor in cpanel. But, on that editor, i cant add such entries. It only allows to select a field and its value only. How can i add custom entries?
begin authenticators
ses_login:
driver = plaintext
public_name = LOGIN
client_send = :
===========
begin routers
send_via_ses:
driver = manualroute
domains = ! +local_domains
transport = ses_smtp
route_list = * email-smtp.us-east-1.amazonaws.com
========
begin transports
#entry for amazon
ses_smtp:
driver = smtp
port = 25
hosts_require_auth = $host_address
hosts_require_tls = $host_address
Entry is something like the above entry. How can i resolve this?
In the Exim Advanced config edit, you can add them.
For the auth, search for the bold text "Section: AUTH" -- there is a text area below it... enter in the "ses_login" details.
For the routers, search for the bold text "Section: PREROUTERS" -- there is a text area below it... enter in the "send_via_ses" details.
Lastly, for the transports, search for the bold text "Section: TRANSPORTSTART" -- there is a text area below it... enter in the "ses_smtp" details.
Once you are finished, scroll all the way down and save your config.. It should now be maintained in your /etc/exim.conf.
You can go to /etc/exim.conf.local which is the customization file for Cpanel. You will find all sections described by half crazed.
In fact, the Advanced configuration page for exim stores all the custom data in exim.conf.local
Since the file is super small, it helps to quickly implement changes and test.

How to explicitly add a cookie in Watir?

I need to set a cookie in IE to execute some specific flow. I tried using the following code
ieb = Watir::IE.new
ieb.document.cookie="rememberme=foobar;Path=/; Domain=sometestdomain.com"
# Bring up browser and do bunch of stuff
However, I see that when the IE comes up, rememberme cookie is not set. Am I doing something wrong here?
You need first open browser with some document loaded from sometestdomain.com.
Then you'll be able to set cookies.