![]() Libraries are a collection of code that can help you solve common problems without needing to write everything yourself. Step 2 - Setting Up Composer for Dependency Management (Optional) Before you test your PHP environment, first set up a dependency manager for your projects. You could start using PHP right now, but you will likely want to use various libraries to build PHP applications quickly. You also installed any required PHP modules and were able to list the modules that you have loaded. You have installed PHP and verified the version you have running. You can list all loaded PHP modules with the following command: PHP configurations related to Apache are stored in /etc/php/7.4/apache2/php.ini. php7.4-bcmath - used when working with precision floats.php7.4-curl - lets you make HTTP requests in PHP.php7.4-mbstring - used to manage non-ASCII strings.php7.4-zip - for working with compressed files.php7.4-mysql - for working with MySQL databases.php7.4-common - documentation, examples, and common modules for PHP.php7.4-json - for working with JSON data.php7.4-cli - command interpreter, useful for testing PHP scripts from a shell or performing general shell scripting tasks.This command will install the following modules: 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.Here are a few suggestions of the most common modules you will most likely want to install: You can also install more than one package at a time. sudo apt-get install php7.4- PACKAGE_NAME.You can use this command to install additional modules, replacing PACKAGE_NAME with the package you wish to install: With Zend OPcache v7.4.0beta4, Copyright (c), by Zend Technologiesīesides PHP itself, you will likely want to install some additional PHP modules. Zend Engine v3.4.0-dev, Copyright (c) Zend Technologies You will receive something similar to the following: ![]() Now you’re ready to install PHP 7.4 using the following command: Next, install the repository ppa:ondrej/php, which will give you all your versions of PHP:įinally, you update apt-get again so your package manager can see the newly listed packages: Without that, you would receive a prompt in your terminal window for each installation. The -y flag will automatically agree to the installation. sudo apt -y install software-properties-common.Next, install software-properties-common, which adds management for additional software sources: Run the following command to update apt-get itself, which ensures that you have access to the latest versions of anything you want to install: You may also wish to install a different version to match an application you are using or to upgrade to a newer version, such as PHP 8. You will want to avoid relying on the default version of PHP because that default version could change depending on where you are running your code. This means that if you attempt to install PHP without a specified version, it will use 7.4. Note: Ubuntu 20.04 ships with PHP 7.4 in its upstream repositories. Alternatively, you can hit the CTRL, ALT, and T keys on your keyboard at the same time to open the Terminal application automatically. Click on the Terminal application icon to open it. On Ubuntu, you can find the Terminal application by clicking on the Ubuntu icon in the upper-left-hand corner of your screen and typing terminal into the search bar. The article An Introduction to the Linux Terminal can get you better oriented with the terminal. There are many terminal commands to learn that can enable you to do more powerful things. The command line, also known as a shell or terminal, can help you modify and automate many of the tasks you do on a computer every day and is an essential tool for software developers. That is, instead of clicking on buttons, you’ll be typing in text and receiving feedback from your computer through text as well. You’ll be completing your installation and setup on the command line, which is a non-graphical way to interact with your computer. You can download this operating system via the Ubuntu releases page. To complete this tutorial, you will need a local or virtual machine with Ubuntu 20.04 installed and have administrative access and an internet connection to that machine. You will also install a dependency manager, Composer, and test your installation by running a script. This tutorial will guide you through installing PHP 7.4 on Ubuntu and setting up a local programming environment via the command line. Getting up and running with your language of choice is the first step in learning to program. PHP is a popular server scripting language known for creating dynamic and interactive web pages. The author selected Open Sourcing Mental Illness Ltd to receive a donation as part of the Write for DOnations program.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |