Results: 1578
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
apt install
Installs
Git
on the server
sudo apt install git
Installs Nginx server
sudo apt install nginx
Installs MySQL Server
sudo apt install mysql-server
Installs php-fpm and php-mysql
sudo apt install php-fpm php-mysql
Installs additional necessary packages for PHP
sudo apt install php-pdo php-common php-dom php-mbstring php-gd php-json php-soap php-xml php-cli php-ldap php-zip
by Valeri Tandilashvili
4 years ago
0
Linux
MySQL
0
apt update
The command gets information from the Internet about updated packages
sudo apt update
by Valeri Tandilashvili
4 years ago
0
Linux
0
create database backup using mysqldump
Creates
backup.sql
backup file of
some_db
database using
some_user
MySQL user. The database is located at
34.mysql.servage.net
server.
mysqldump -h 34.mysql.servage.net -u some_user -p some_db > backup.sql
Creates
backup.sql
backup file of
some_db
database with the same MySQL user but without
-h
flag. If the database is located on the same server (localhost)
-h
flag is not necessary to specify
mysqldump -u some_user -p some_db > backup.sql
If we want to include all the routines (procedures, functions), then we need to use flag
-R
mysqldump -u some_user -p some_db -R > backup.sql
If we want to export only one or several tables, then we should list tables after database name
mysqldump -u root -p sdtokens sdt_prices another_table > sdt_prices.sql
After running the command, we will be required to enter password of the
some_user
mysql user. After that, MySQL will create
backup.sql
file on the same location
by Valeri Tandilashvili
4 years ago
0
Linux
MySQL
Command line
0
Grant all privileges
Grants all privileges to
some_user
user on all
some_db
database tables
GRANT ALL PRIVILEGES ON some_db.* TO 'some_user'@'localhost';
by Valeri Tandilashvili
4 years ago
0
MySQL
GRANT
1
MySQL command line
Activates MySQL console
mysql -u some_user -p
After running the command, we will be required to enter
password
of the mysql user
some_user
After that, MySQL
console
will be activated where we can run MySQL queries
by Valeri Tandilashvili
4 years ago
0
Linux
MySQL
0
delete folder
Removes unwanted folder
some_folder
sudo rm -r some_folder/
-r
means that it removes the directory with its all child directories
by Valeri Tandilashvili
4 years ago
0
Linux
0
move file to another directory
Moves
file.zip
file into
some_folder
folder
sudo mv file.zip some_folder/
In this example
file.zip
file and
some_folder
folder are at the same folder level (they have the same parent folder)
by Valeri Tandilashvili
4 years ago
0
Linux
0
create directory
Creates
testdirectory
directory to the location that the console is pointing at
sudo mkdir testdirectory
by Valeri Tandilashvili
4 years ago
0
Linux
0
PHP technically doesn't allow it. But we can do it using
func_get_args
and
func_num_args
functions.
func_get_args
Gets function arguments
func_num_args
Gets amount of function arguments.

class myClass {
    public function __construct() {
        $get_arguments       = func_get_args();
        $number_of_arguments = func_num_args();

        if (method_exists($this, $method_name = '__construct'.$number_of_arguments)) {
            call_user_func_array(array($this, $method_name), $get_arguments);
        }
    }

    public function __construct1($argument1) {
        echo 'constructor with 1 parameter ' . $argument1 . "\n";
    }

    public function __construct2($argument1, $argument2) {
        echo 'constructor with 2 parameter ' . $argument1 . ' ' . $argument2 . "\n";
    }

    public function __construct3($argument1, $argument2, $argument3) {
        echo 'constructor with 3 parameter ' . $argument1 . ' ' . $argument2 . ' ' . $argument3 . "\n";
    }
}

$object1 = new myClass('BUET');
$object2 = new myClass('BUET', 'is');
$object3 = new myClass('BUET', 'is', 'Best.');
by Luka Tatarishvili
4 years ago
0
PHP
oop
2
move file to another server using scp
Moves
sql.zip
file to the location
/var/www/
of
use.ge
server using
root
user
scp sql.zip root@use.ge:/var/www/
We can use full path for the file that we want to move
scp /var/www/sql.zip root@use.ge:/var/www/
We can also use an IP address (instead of domain name) to specify the server that we want the file to move to
scp /var/www/sql.zip root@167.172.187.21:/var/www/
After the command execution the user is required to enter password of
root
user
by Valeri Tandilashvili
4 years ago
0
Linux
0
Results: 1578