How to install PHP and other php libraries into Ubuntu for Laravel
How to install PHP and other PHP libraries into Ubuntu for Laravel
In this tutorial, I am going to show you how to install PHP libraries manually for Laravel.
Step 1: Run the following command to update apt-get itself.
sudo apt-get update
Step 2: Next, install software-properties-common, which adds management for additional software sources: The -y flag will automatically agree to the installation. Without that, you would receive a prompt in your terminal window for each installation.
sudo apt -y install software-properties-common
Step 3: Next, install the repository ppa:ondrej/php, which will give you all your versions of PHP:
sudo add-apt-repository ppa:ondrej/php
Step 4: Finally, you update apt-get again so your package manager can see the newly listed packages:
sudo apt-get update
Step 5: Now you’re ready to install PHP 7.4 using the following command:
sudo apt -y install php7.4
Step 6: Check the version installed:
php -v
Step 7: Check the version installed:
sudo apt-get install -y php7.4-cli php7.4-json php7.4-common php7.4-mysql php7.4-zip php7.4-gd php7.4-mbstring php7.4-curl php7.4-xml php7.4-bcmath
Step 6: This command will install the following modules:
php7.4-cli - command interpreter, useful for testing PHP scripts from a shell or performing general shell scripting tasks
php7.4-json - for working with JSON data
php7.4-common - documentation, examples, and common modules for PHP
php7.4-mysql - for working with MySQL databases
php7.4-zip - for working with compressed files
php7.4-gd - for working with images
php7.4-mbstring - used to manage non-ASCII strings
php7.4-curl - lets you make HTTP requests in PHP
php7.4-xml - for working with XML data
php7.4-bcmath - used when working with precision floats
PHP configurations related to Apache are stored in /etc/php/7.4/apache2/php.ini. You can list all loaded PHP modules with the following command:
php -m
Finally, we have installed PHP and verified the version running.
Comments
Post a Comment