How to change base_url settings with mysql from the command line
- Log into your MySQL database, replace $USER with your database user name
and $DBASE with your database name. It will prompt you for your password:
mysql -u $USER -p $DBASE - Below are the SQL commands to change your base_url values. Replace
unsecure http://www.example.com/ and secure https://www.example.com/ (if
you have SSL/TLS enabled, else https should be http) with your appropriate
domain url (trailing slash necessary) and if you’ve installed in a subfolder
append it with a /
after it.
SQL Commands
UPDATE core_config_data SET value = ‘http://www.example.com/’ WHERE path LIKE
‘web/unsecure/base_url’ ;
UPDATE core_config_data SET value = ‘https://www.example.com/’ WHERE path LIKE
‘web/secure/base_url’ ; - Check your base_url settings with the following:
SQL Commands
SELECT path,value FROM core_config_data WHERE path LIKE ‘
web/unsecure/base%’ ;
SELECT path,value FROM core_config_data WHERE path LIKE ‘
web/secure/base%’ ;
Clear Cache
Go to the magento folder like /home/hostingguru/public_html
bin/magento cache:flush
Changing file permissions after importing data from client server to our server
We need to set both user and group as hostingguruin
Pwd
/home/hostingguruin
chgrp -R hostingguruin public_htmlchown -R hostingguruin public_html
How to get version of magento 2
Go to CLI, Locate your Magento Root Folder & Run below command
php bin/magento –version
How to edit Magento 2 Database Configuration file
Go to app/etc/env.php then update this:
‘db’ => array ( ‘table_prefix’ => ” , ‘connection’ => array ( ‘default’ =>
array ( ‘host’ => ‘localhost’ , ‘dbname’ => ‘database_name’ , ‘username’ =>
‘database_username’ , ‘password’ => ‘database_password’ , ‘active’ => ‘1’ , ), ),
),
How to reset lost admin password in Magento 2?
/bin/magento admin:user:create –admin-user=”admin”
–admin-password=”123123q” –admin-email=”[email protected]”
–admin-firstname=”bum” –admin-lastname=”kumar”
Magento uses maintenance mode to disable bootstrapping; for example, while you’re
maintaining, upgrading, or reconfiguring your site.
[[email protected] bin]
$ ./magento maintenance:enableEnabled maintenance mode
[[email protected] bin]
$ ./magento maintenance:disable
Disabled maintenance mode
Change the current timezone in C
entOS 7
timedatectl list-timezones | grep Asia
timedatectl set-timezone America/Chicago
Verify new settings by typing the following two commands:
Disabled maintenance mode
Change the current timezone in C
entOS 7
timedatectl list-timezones | grep Asia
timedatectl set-timezone America/Chicago
Verify new settings by typing the following two commands:
date
ls -l /etc/localtime
Using WHM login as root user then search server configuration and then
click on that and select server time
To extract .sql.gz
filegzip -d example.sql.gz
dumping mysqldb to remote machinemysqldump [mysqldump options] | gzip -c | ssh [email protected] “cat >
/path/to/some-file.sql.gz”
Create tar.gz Archive File
tar cvzf MyImages-14-09-12.tar.gz /home/MyImages
to set the database timezone to UTC00
add in my.cnf file
default-time-zone=’+00:00′
WordPress .htacess rewrite rules
BEGIN WordPress
RewriteEngine On RewriteBase / RewriteRule ^index.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]
END WordPress
Zimbra
Su – zimbra
zmcontrol status
zmcontrol stopFile permission for migration or staging
Make sure that the htaccess file is readable by apache:
chmod 644 / var /www/abc/.htaccess
And make sure the directory it’s in is readable and executable:
chmod 755 / var /www/abc/
Magento version check
Get the current Magento version string using getVersion function inside the Mage.php file.
Run the following command in terminal
php -r “include ‘app/Mage.php’; echo ‘Magento version is: ‘, Mage::getVersion(); “
For example:
click on that and select server time
To extract .sql.gz
filegzip -d example.sql.gz
dumping mysqldb to remote machinemysqldump [mysqldump options] | gzip -c | ssh [email protected] “cat >
/path/to/some-file.sql.gz”
Create tar.gz Archive File
tar cvzf MyImages-14-09-12.tar.gz /home/MyImages
to set the database timezone to UTC00
add in my.cnf file
default-time-zone=’+00:00′
WordPress .htacess rewrite rules
BEGIN WordPress
RewriteEngine On RewriteBase / RewriteRule ^index.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]
END WordPress
Zimbra
Su – zimbra
zmcontrol status
zmcontrol stopFile permission for migration or staging
Make sure that the htaccess file is readable by apache:
chmod 644 / var /www/abc/.htaccess
And make sure the directory it’s in is readable and executable:
chmod 755 / var /www/abc/
Magento version check
Get the current Magento version string using getVersion function inside the Mage.php file.
Run the following command in terminal
php -r “include ‘app/Mage.php’; echo ‘Magento version is: ‘, Mage::getVersion(); “
For example:
cd /home/cp_user/public_html/
php -r “include ‘app/Mage.php’; echo ‘Magento version is: ‘, Mage::getVersion(); “
Magento version is: 1.9.2.2
Flush Redis databases
If you are using Redis for caching or sessions, you may need to clear it during development or
to troubleshoot a site problem. You can flush redis directly via the command line using the
example commands below.
Flush Redis databases
If you are using Redis for caching or sessions, you may need to clear it during development or
to troubleshoot a site problem. You can flush redis directly via the command line using the
example commands below.
redis-cli flushall
flushes all redis databaes
redis-cli -n 1 flushdb
flushes specific redis database numberActivate cpanel license
Manage2.cpanel.net
- Login to cpanel from zoho vault
- Enter the ip and select serverguy internal VPS
- purchase a cPanel license .
- login your server via SSH.
- run usr/local/ cpanel /cpkeyclt command and wait until its accomplishment.
KBC questions answers
1989
DAV
110085
1
Actions
How to enable SSL in a website
Login to WHM
Then search manage AutoSSL
AutoSSL Providers
Choose an AutoSSL provider: (Show/Hide Details)Disabled
cPanel (powered by Sectigo)
Let’s EncryptTM
FleetSSL (internal use only, don’t use in WHM AutoSSL)
Select let’s encrypt
Then go to manage Users and select domain to activate and check again in incongnito.
Enable Apache Redirect in the Virtual Host
Enabling the redirect in the Virtual Host file is safer and simpler than other options, as the
configuration will be similar for all systems. Usually, there are two Virtual Host files on Apache if
an SSL certificate is installed: one is for the non-secure port 80, and the other is for the secure
port 443. The redirect to HTTPS can be enabled in the virtual host for port 80. If you would like
to force HTTPS only for certain webpages, you can use the following set of directives:
ServerName www.yourdomain.com DocumentRoot /usr/local/apache2/htdocs Redirect permanent /secure https://yourdomain.com/secure
ServerName www.yourdomain.com DocumentRoot /usr/local/apache2/htdocs SSLEngine On…
where /secure is the directory you would like Apache to force https for.
ServerName example.com Redirect / https://example.com/
How to implement cdn in magento
Create an alias name like cdn.domainname.com
Then check whether this domain points to the same site or not and open website and click inspect and
then in element select any image and copy url and paste it on new tab and change front url to cdn one
check whether a image loads with cdn url like
http://cdn.readers.in/pub/media/amasty/shopby/option_images/slider/cross_1.png
If opens means cdn is working fine
https://cdn.readers.in/skin
https://cdn.readers.in/media
Before doing any changes in backend take database dump as if page break restore it from
database and clear cache php bin/magento cache:clean
Paste this urls in backend
Base URL for Static View
FilesBase URL for User Media
Files
If page get break then estore it from database and clear cache php bin/magento cache:clean