Running XAMPP on Ubuntu using Terminal

To start XAMPP run the following and the command will return a list of running services:

sudo /opt/lampp/lampp start

To stop XAMPP run the command below and it will return a list of the stopped services.

sudo /opt/lampp/lampp stop

You can also stop/start/restart individual services by appending “apache”, “mysql” or “ftp” to the end.

Starting

start – Start XAMPP (Apache, MySQL and eventually others)
startapache – Start only Apache
startmysql – Start only MySQL
startftp – Start only ProFTPD

Stopping

stop – Stop XAMPP (Apache, MySQL and eventually others)
stopapache – Stop only Apache
stopmysql – Stop only MySQL
stopftp – Stop only ProFTPD

Restart

reload – Reload XAMPP (Apache, MySQL and eventually others)
reloadapache – Reload only Apache
reloadmysql – Reload only MySQL
reloadftp – Reload only ProFTPD
restart – Stop and start XAMPP

SSL & Security

security – Check XAMPP’s security
enablessl – Enable SSL support for Apache
disablessl – Disable SSL support for Apache

Config

backup – Make backup file of your XAMPP config, log and data files
oci8 – Enable the oci8 extenssion

GUI Panel

panel – Starts graphical XAMPP control panel

Enable Magento2 Command-Line Interface (CLI) on Linux

For both development, ongoing management and scheduled tasks Magento’s Command Line Interface is able to do it all.

To enable CLI for Magento to you’ll need to make sure the file /bin/magento is executable by the system.

If you’re on the server SSH into the root of your Magneto install and run the command

chmod +x bin/magento

If you’re on desktop simply locate the file in your file explorer, right click and set the “Allow executing file as program” checkbox on the Permissions tab.

Magento Server Transfer – Tried and Tested Method

Moving an entire Magento site from one server to another or between hosts can be a daunting task for non-server administrators.

I’m going to try and expand this over time.

  • Agree time frames, a day for file system sync, an hour for database update and DNS update.
  • Content Freeze – no new images or content is added by Store owner, customers continue to place orders and create accounts.
    • A copy of the site is downloaded to the new server via FTP
    • A snapshot of the database is taken and used to test the site on the new server
  • Database Freeze – no new orders, holding page on the front end, Admin Panel still accessible if required but no updates allowed.
    • Export/import database
      • Old Server: mysqldump -u YourUser -p YourDatabaseName > wantedsqlfile.sql
      • New Server wget http://www.yourwebsite.com/wantedsqlfile.sql
      • New Server: mysql -u YourUser -p YourDatabaseName < wanted.sql
    • Copy over/configure your SSL for the new site
    • Next-up is the DNS update to repoint the domain
  • Done

 

MySQL Database Backup and Restore via Command Line (Copy-and-pasteable)

Putting this together because I always end up checking online for the correct bash commands for Linux. These commands rely on your knowing for sure which database is which and you should always double check to be sure.

Export

First step is to go to use cd to change directory to the one in which you want the SQL Dump to appear. The dump will consist of a text file and all the database structure and content included.

cd var/www/example.com

If you want to double check the contents of the directory you are in then simply enter ls and a list of directories and files will be returned.

ls

When you’re happy you’re in the right directory, we can export the file. In this instance I have a user name (user123) after the -uand the database is database_live and the initial -p means bash will ask me for the password.

mysqldump -p -uuser123 database_live > mydumpfile.sql

Hit enter, enter the password and after some serious thinking (depending on the size of the database) you’ll be able to enter the next command. Again, entering ls will allow you to verify there is a file called mydumpfile.sql in the directory.

Import

The next step is then to import the database into your other database. It should be noted that importing the previous dump will with default configuration wipe any existing data during the import into the second database.

In the instance below I have a user name (uuser456 ) after the -uand the database is database_live and the initial -p means bash will ask me for the password.

mysql -p -uuser456 database_backup < mydumpfile.sql

Hit enter, enter the password for the user and again it will hang while the details are imported.

Magento: Clear all caches through command line

When making certain changes to Magento, such as modifying source files, installing extensions, reverting changes, it is necessary to clear the cache in order for the changes to become visible.

Oftentimes the Admin Panel > System -> Cache Management then “Flush Magento Cache” will not have the desired affect.

Command Line

Delete the contents of the var/cache/ folder using the following Linux SSH command. This command MUST be executed from your Magento base directory for it to work properly.

rm -rf var/cache/*

After the cache has been wiped, session values will also need to be cleared from the system. This command MUST be executed from your Magento base directory for it to work properly.

rm -rf var/session/*

Finally once the site has been cleared of old cached and logged data for best results a complete Reindex of the site is recommended.

php shell/indexer.php --reindexall

ka.lpe.sh Script

ka.lpe.sh have put together a really good script for programmatically clearing the cash from SSH. Create a file in your Magento root and name it clearCache.php with the below code: