Can’t access DB or phpmyadmin locally

If you got an error like: “Host ‘localhost’ is not allowed to connect to this MariaDB server” you can edit the file xampp\mysql\bin\my.ini

Add this line:
skip-grant-tables
after [mysqld] group.

Example:
[mysqld]
skip-grant-tables
port=3306
socket=/tmp/mysql.sock

After that, login to phpmyadmin and repair the users table as it mostly is corrupted.

How to update Magento 2

Try the CLI update process:

1) On your terminal go into magento root folder.
2) Set magento 2 under maintenance mode

php bin/magento maintenance:enable

3) Search for the correct and latest magento 2 version

composer show magento/product-community-edition 2.3.* --all | grep -m 1 versions

4) Force your composer to use the latest version

composer require magento/product-community-edition=2.3.3 --no-update

5) Update your magento 2 installation

composer update

6) After successful update Upgrade magento and compile

php bin/magento setup:upgrade
bin/magento setup:di:compile

7) Disable maintenance mode and you are ready to check the correct version

php bin/magento maintenance:disable

from: https://community.magento.com/t5/Magento-2-x-Version-Upgrades/Upgrade-from-2-3-1-to-2-3-2-security-updates-correct-version-not/td-p/135324

How to put Magento 2 in maintenance mode

Even I think this should be a simple checkbox in Magento Control Panel but the most simple way I found is to put a file in var folder with the name of: var/.maintenance.flag

If you want to allow an ip or a group of ips you simply write this list of ips in a file: var/.maintenance.ip

Of course if you have access to CLI you can just type:

bin/magento maintenance:enable –ip=1.2.3.4

where –ip=1.2.3.4 is the ip that can access the website normally ..

if you use a shared hosting, to run the above command you have to go to the public_html folder first :
cd public_html

and then run the command using php
php bin/magento maintenance:enable –ip=1.2.3.4

For more information go to :
https://devdocs.magento.com/guides/v2.3/install-gde/install/cli/install-cli-subcommands-maint.html

How to read file content in Public folder with Laravel

If you want to read the content of a file in the public folder using Laravel, you can use this code

$file_name = "test.dat";
$file_url = 'public\subfolder\\'. $file_name;
$content = file_get_contents(base_path($map_url));

base_path is a helper function to generate a fully qualified path to a given file relative to the project root directory

How to configure your host in one company and your email in another

If you want to host your website with one company and your emails in another you have to edit your domain name DNS Zone.

All you have to do is to add A host @ to point to your website host and “mail” to point to your email server and finally add MX record @ with priority 0 and Points to mail.yourdomain.com ..

For more details, check this page:

How to solve “gpg: public key decryption failed: Bad passphrase” in batch file

If you are trying to decrypt a file or a bunch of files using batch file in windows you will write something like this:

gpg --pinentry-mode=loopback --batch --yes --passphrase "abc%123" --decrypt-files *.pgp

and you put the above code in a .bat file and run it but you got an error like:

gpg: public key decryption failed: Bad passphrase

You are 1000% sure the passphrase is correct .. well the problem is in the passphrase itself as it contains a special character that needs to be escaped .. in the above example , the passphrase : “abc%123” must be written like this: “abc%%123” as %% is the escape of % … for a complete list of batch file escape characters , check this link

in case if you are wondering about the meaning of
–pinentry-mode=loopback¬†¬†
it is used to prevent the gui from pooping up and asking for the passphrase.

Another important point , to make the batch option work without problem .. you have to make sure that the encrypted file extensions is *.pgp