Password protect a folder in xampp

Here is how to protect a folder with username and password in xampp :

  1. Open the command promote
  2. Go to your xampp folder and then go to: /apache/bin/
  3. Run this command :

    htpasswd.exe -c -b .htpasswd my_user _name my_password

    Don’t forget Change “my_user_name” and “my_password”
  4. A file with the name of .htpasswd will be created at the folder of /apache/bin
  5. Create a file with the name of : .htaccess at the folder you want to protect ( don’t forget the dot in .htaccess)
  6. Write the following in the .htaccess file:

    AuthType Basic
    AuthName “v3d”
    AuthUserFile “c:/xampp/apache/bin/.htpasswd”
    require valid-user


    Note that the path in AuthUserFile line (c:/xampp/apache/bin/.htpasswd) is the path to your xampp folder where the .htpasswd file is created, very important to keep this file away from the httdocs folder.

Can’t install extensions on VSCode?

If you are trying to install extensions on VSCode but you can’t. Try to visit this site from your browser:

http://cdn.vsassets.io/

Most probably you will get a “This site can’t be reached” message, to solve this you have to change your default DNS to google free public DNS

8.8.8.8
8.8.4.4

If that may not work for you then yo can try to change the DNS for IPv6 to:

2001:4860:4860::8888
2001:4860:4860::8844

Here is a link for more details on changing the DNS to google DNS

https://developers.google.com/speed/public-dns/docs/using

How to install composer on Godaddy cPanel

If you want to install composer on a godaddy shared hosting, you can follow these steps:

On root folder type:

wget https://getcomposer.org/installer
php installer --check
php installer
rm -f installer

to return the path of composer type:

which composer

it’ll return something like: /opt/cpanel/composer/bin/composer

then you can use composer using its full path:
php-cli /opt/cpanel/composer/bin/composer install

for ex. :

php-cli /opt/cpanel/composer/bin/composer install
php-cli /opt/cpanel/composer/bin/composer update

Also if you want to run php artisan , you can type:

/usr/bin/php-cli artisan

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.

Also try to rename :

xampp\mysql\data\ibdata1
to
xampp\mysql\data\ibdata1.bak

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