, ,

How To Install PHP 7.3, 7.2, 7.1 on CentOS/RHEL 6.10

PHP 7.3 is the latest stable release of PHP. May of popular yum repositories is providing rpm packages for PHP 7. This article is using Remi and EPEL yum repositories for installing required packages on your system. This article will help you to install PHP 7.3, PHP 7.2, PHP 7.1 on CentOS & RHEL 6 systems.

Configure Yum Repository

First of all, you need to enable Remi and EPEL yum repositories on your system. Use the following command to install EPEL repository on your CentOS and Red Hat 7/6 systems

Use this command to install epel-release yum repository

yum install epel-release

and now execute one of the following commands as per your operating system version to install Remi repository.

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Install PHP 7 on CentOS 6

Your system is prepared for the PHP installation from yum repositories. Use one of the following commands to install PHP 7.3 or PHP 7.2 or PHP 7.1 on your system based on your requirements.

## Install PHP 7.3 
yum --enablerepo=remi-php73 install php

## Install PHP 7.2 
yum --enablerepo=remi-php72 install php

## Install PHP 7.1 
yum --enablerepo=remi-php71 install php

I have installed the latest version PHP 7.3 on my system. Now running the following command to check current active PHP version on my system.

php -v

PHP 7.3.11 (cli) (built: Oct 22 2019 12:34:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies

Install PHP Modules

You may also need to install additional PHP modules based on your application requirements. Below command will install some more useful PHP modules.

### For PHP 7.3
yum --enablerepo=remi-php73 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

### For PHP 7.2
yum --enablerepo=remi-php72 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

### For PHP 7.1
yum --enablerepo=remi-php71 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

You can run the following command to search other available PHP modules under configured yum repositories. Below example command search for all modules for PHP 7.3.

yum --enablerepo=remi-php73 search php | grep php73

php73.x86_64 : Package that installs PHP 7.3
php73-php.x86_64 : PHP scripting language for creating dynamic web sites
php73-php-bcmath.x86_64 : A module for PHP applications for using the bcmath
php73-php-brotli.x86_64 : Brotli Extension for PHP
php73-php-cli.x86_64 : Command-line interface for PHP
php73-php-common.x86_64 : Common files for PHP
...
...
Continue reading How To Install PHP 7.3, 7.2, 7.1 on CentOS/RHEL 6.10
, , ,

How to start, stop & restart MariaDB server in Linux

 MariaDB is a MySQL database management system and popular nowadays.

It is one of the pillars of the LAMP stack popular among developers. In this article, we will walk you through steps to manage the MariaDB server process from the command line shell prompt.

In newer systems like RHEL 7, Debian 8, Ubuntu 15.04, Suse 12 and later system V init daemon is replaced by systemd. We will see both systemd and system V init commands to manage the MariaDB server process. Be noted that we are dealing with the MariaDB server process only. You have to take care of the databases you build within for their graceful shutdown and startup.

How to start MariaDB server

On newer systems with systemd

# systemctl start mariadb

On older systems with system V init

# service mysql start
Starting MariaDB.190110 07:15:32 mysqld_safe Logging to '/var/lib/mysql/kerneltalks.test.err'.
190110 07:15:32 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
.                                                          [  OK  ]

How to start MariaDB server at boot

On newer systems with systemd

# systemctl enable mariadb
ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'

On older systems with system V init

Systems like RHEL, CentOS, SUSE uses chkconfig to manage processes at boot.

# chkconfig --add mysql
# chkconfig --level 345 mysql on

Systems like Debian, ubuntu uses update-rc.d

# update-rc.d mysql defaults

How to stop MariaDB server

On newer systems with systemd

# systemctl stop mariadb

On older systems with system V init

# service mysql stop
Shutting down MariaDB.                                     [  OK  ]

How to check MariaDB server status

On newer systems with systemd

# systemctl status mariadb
mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)
   Active: active (running) since Thu 2019-01-10 02:32:04 EST; 1min 35s ago
 Main PID: 10853 (mysqld_safe)
   CGroup: /system.slice/mariadb.service
           ├─10853 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
           └─11015 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-fi...
 
Jan 10 02:32:00 ip-172-31-89-93.ec2.internal mariadb-prepare-db-dir[10775]: MySQL manual for more instructions.
Jan 10 02:32:00 ip-172-31-89-93.ec2.internal mariadb-prepare-db-dir[10775]: Please report any problems at http://mariadb.org/jira
Jan 10 02:32:00 ip-172-31-89-93.ec2.internal mariadb-prepare-db-dir[10775]: The latest information about MariaDB is available at http://mariadb.org/.
Jan 10 02:32:00 ip-172-31-89-93.ec2.internal mariadb-prepare-db-dir[10775]: You can find additional information about the MySQL part at:
Jan 10 02:32:00 ip-172-31-89-93.ec2.internal mariadb-prepare-db-dir[10775]: http://dev.mysql.com
Jan 10 02:32:00 ip-172-31-89-93.ec2.internal mariadb-prepare-db-dir[10775]: Consider joining MariaDB's strong and vibrant community:
Jan 10 02:32:00 ip-172-31-89-93.ec2.internal mariadb-prepare-db-dir[10775]: https://mariadb.org/get-involved/
Jan 10 02:32:01 ip-172-31-89-93.ec2.internal mysqld_safe[10853]: 190110 02:32:01 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Jan 10 02:32:01 ip-172-31-89-93.ec2.internal mysqld_safe[10853]: 190110 02:32:01 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Jan 10 02:32:04 ip-172-31-89-93.ec2.internal systemd[1]: Started MariaDB database server.

On older systems with system V init

# service mysql status
MariaDB running (2122)                                     [  OK  ]

How to restart MariaDB server process

On newer systems with systemd

root@kerneltalks # systemctl restart mariadb

On older systems with system V init

root@kerneltalks # service mysql restart
Shutting down MariaDB....                                  [  OK  ]
Starting MariaDB.190110 07:35:01 mysqld_safe Logging to '/var/lib/mysql/ip-172-31-90-145.ec2.internal.err'.
190110 07:35:01 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
.                                                          [  OK  ]

Continue reading How to start, stop & restart MariaDB server in Linux