Install all php7 4 extension
The author selected Open Sourcing Mental Illness Ltd to receive a donation as part of the Write for DOnations program. Show IntroductionPHP is a popular server scripting language known for creating dynamic and interactive web pages. Getting up and running with your language of choice is the first step in learning to program. This tutorial will guide you through installing PHP 7.4 on Ubuntu and setting up a local programming environment via the command line. You will also install a dependency manager, Composer, and test your installation by running a script. PrerequisitesTo 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 can download this operating system via the Ubuntu releases page. Step 1 — Setting Up PHP 7.4You’ll be completing your installation and setup on the command line, which is a non-graphical way to interact with your computer. That is, instead of clicking on buttons, you’ll be typing in text and receiving feedback from your computer through text as well. 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. There are many terminal commands to learn that can enable you to do more powerful things. The article An Introduction to the Linux Terminal can get you better oriented with the terminal. 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 Note: Ubuntu 20.04 ships with PHP 7.4 in its upstream repositories. This means that if you attempt to install PHP without a specified version, it will use 7.4. 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. 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. Run the
following command to update
Next, install
The Next, install the repository
Finally,
you update
Now you’re ready to install PHP 7.4 using the following command:
Check the version installed:
You will receive something similar to the following:
Besides PHP itself, you will likely want to install some additional PHP modules. You can use this command to install additional modules, replacing
You can also install more than one package at a time. Here are a few suggestions of the most common modules you will most likely want to install:
This command will install the following modules:
PHP configurations related to Apache are stored in
You have installed PHP and verified the version you have running. You also installed any required PHP modules and were able to list the modules that you have loaded. You could start using PHP right now, but you will likely want to use various libraries to build PHP applications quickly. Before you test your PHP environment, first set up a dependency manager for your projects. Step 2 — Setting Up Composer for Dependency Management (Optional)Libraries are a collection of code that can help you solve common problems without needing to write everything yourself. Since there are many libraries available, using a dependency manager will help you manage multiple libraries as you become more experienced in writing PHP. Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and will manage installing and updating these packages. Although
similar, Composer is not a package manager in the same sense as This idea is not new, and Composer is strongly inspired by Node’s Suppose:
Composer:
There are, in short, two ways to install Composer: locally as part of your project or globally as a system-wide executable. Either way, you will start with the local install. LocallyTo quickly install Composer in the current directory, run this script in your terminal:
This installer script will check some
The installer will check a few PHP settings and then download In order to run Composer, you use
To use Composer locally, you will want your Since Composer is something used across projects, it’s recommended that you continue to the next portion and set Composer to run globally. GloballyYou can place the Composer PHAR anywhere you wish. If you put it in a directory that is part of your After installing locally, run this command to move
If you’d like to install it only for your user and avoid requiring root permissions, you can use
Now to run Composer, use
As a final step, you may optionally initialize your project
with Run this command to initialize a project:
Running this command will start the setup wizard. Details that you
enter in the wizard can be updated later, so feel free to leave the defaults and just press
Before you confirm the generation, you will see a sample of the The first time you define any dependency, Composer
will create a Note: The Now that you have PHP installed and a way to manage your project dependencies using Composer, you’re ready to test your environment. Step 3 — Testing the PHP EnvironmentTo test that your system is configured correctly for PHP, you can create and run a basic PHP script. Call this script
This will open a blank file. Put the following text, which is valid PHP code, inside the file: hello.php
Once you’ve added the text, save and close the file. You can do this by holding down the Now you can test to make sure that PHP processes your script correctly. Type
If the PHP is processed properly, you will see only the characters within the quotes:
PHP has successfully processed the script, meaning that your PHP environment is successfully installed and you’re ready to continue your programming journey. ConclusionAt this point, you have a PHP 7.4 programming environment set up on your local Ubuntu machine and can begin a coding project. Before you start coding, you may want to set up an Integrated Development Environment (IDE). While there are many IDEs to choose from, VS Code is a popular choice as it offers many powerful features such as a graphical interface, syntax highlighting, and debugging. With your local machine ready for software development, you can continue to learn more about coding in PHP by following How To Work With Strings in PHP. How do I install PHP extensions?Restart your php. Install the PHP development package.. Download & unzip the PHP5 source code.. Prepare the extension (phpize). Configure & Make the extension.. Move the extension.. Edit your PHP.INI.. Restart your php.. How do I install PHP7 on Windows 10?Install PHP 7 on Windows 10. Install the Visual C++ Redistributable for Visual Studio 2015—this is linked in the sidebar of the PHP for Windows Download page, but it's kind of hidden. ... . Download PHP for Windows. ... . Expand the zip file into the path C:\PHP7 .. Configure PHP to run correctly on your system:. How do I compile PHP7 4?PHP7-from-scratch. Step 1: Create directory for the PHP Binaries. ... . Step 2: Add the bin directory to your Path. ... . Step 3: Install packages to prepare our system. ... . Step 4: Download Latest PHP 7.4. ... . Step 5: Build a build script. ... . Step 6: Compile PHP. ... . Step 7: Edit the PHP. ... . Step 8: Edit the php.ini file to change your sessings.. How can I run multiple PHP versions in Ubuntu?How to Install Multiple PHP Versions on Ubuntu 22.04. Step 1: System Update. First, log in to Ubuntu 22.04 via console. ... . Step 2: Installing Multiple PHP Versions on Ubuntu 22.04. ... . Step 3: Check Active PHP Version. ... . Step 4: Switch Default PHP Version for CLI. ... . Step 5: Uninstalling PHP Versions.. |