November 25, 2022

Basic Ubuntu Problems

If you’re new to Ubuntu, you might be wondering what to do when you encounter a problem. This article will help you understand some basic Ubuntu problems and how to fix them.

One common problem is that Ubuntu won’t boot up. This can be caused by a number of things, but the most common cause is that your computer’s BIOS is not set to boot from the Ubuntu CD. To fix this, you’ll need to change your BIOS settings. Another common problem is that Ubuntu freezes during boot up. This can be caused by a number of things, but the most common cause is that your computer’s BIOS is not set to boot from the Ubuntu CD. To fix this, you’ll need to change your BIOS settings.

If you’re having trouble getting Ubuntu to work with your hardware, it’s likely that you’re missing some drivers. Ubuntu includes a lot of drivers, but there are still some devices that require drivers that are not included. The best way to find and install drivers is to use the Ubuntu Hardware Drivers utility. This tool will search for and install the drivers you need.

How to become superuser on Ubuntu Linux

$ sudo -i
## OR ##
$ sudo -s
  1. When promoted provide your own password.
  2. After successful login, the prompt would change to to indicate that you logged in as root user on Ubuntu.
  3. You can also type the whoami command to see that you logged as the root user.

How to change root password in Ubuntu

The procedure to change the root user password on Ubuntu Linux:

  1. Type the following command to become root user and issue passwd:
    sudo -i
    passwd
  2. OR set a password for root user in a single go:
    sudo passwd root
  3. Test it your root password by typing the following command:
    su -

How to disable your root account on Ubuntu

One can disable the root account by typing the following command:
$ sudo passwd -dl root
OR
$ sudo passwd --delete --lock root

Installing PHP 8.0 in Ubuntu

PHP 8.0 is the latest major release of the PHP language. It introduces several breaking changes, performance improvements, and lots of new features such as named arguments, JIT compiler, union types, match expression, and more.

This article will show you how to install PHP 8 on Ubuntu 20.04 and integrate it with Nginx and Apache.

At the time of writing, the default Ubuntu 20.04 repositories include PHP 7.4 version. We’ll install PHP from the ondrej/php PPA repository.

Before upgrading to or installing PHP 8, make sure that your applications support it.

The same steps apply for Ubuntu 18.04 and all Ubuntu-based distribution, including Kubuntu, Linux Mint, and Elementary OS.

Enabling PHP Repository

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php

Installing PHP 8.0 with Apache

If you’re using Apache as a web server, you can run PHP as an Apache module or PHP-FPM.

Install PHP as Apache Module

Installing PHP as an Apache module is a straightforward task:

sudo apt update
sudo apt install php8.0 libapache2-mod-php8.0

Once the packages are installed, restart Apache for the PHP module to get loaded:

sudo systemctl restart apache2

Configure Apache with PHP-FPM 

Php-FPM is a FastCGI process manager for PHP. Run the following command to install the necessary packages:

sudo apt update
sudo apt install php8.0-fpm libapache2-mod-fcgid

By default PHP-FPM is not enabled in Apache. To enable it, run:

sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php8.0-fpm

To activate the changes, restart Apache:

systemctl restart apache2

Install php 8.0 extensions

sudo apt install php8.0-{cgi,cli,fpm,pdo,gd,mbstring,mysqlnd,opcache,xml,zip}

Using both Php Version at same time on Ubuntu Virtialmin

Enable ondrej/php repository

LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php && apt-get update

Install additional PHP packages

apt-get install php8.0-{cgi,cli,fpm,pdo,gd,mbstring,mysqlnd,opcache,xml,zip}

Installing PHP extensions

PHP extensions are compiled libraries that extend the core functionality of PHP. Extensions are available as packages and can be easily installed with apt :

sudo apt install php8.0-[extname]

For example, to install MySQL and GD extensions, you would run the following command:

sudo apt install php8.0-mysql php8.0-gd

After installing a new PHP extension, do not forget to restart Apache or PHP FPM service, depending on your setup.

Check PhP Version

php -v

Output:

PHP 8.0.25 (cli) (built: Oct 28 2022 18:02:51) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.25, Copyright (c) Zend Technologies with Zend OPcache v8.0.25, Copyright (c), by Zend Technologies

Leave a Reply

Your email address will not be published. Required fields are marked *