Install intl php 7.2 ubuntu
Show
PHP and related packages are the most commonly used components when deploying a web server. In this article, we will learn how to setup PHP 7.2 on Ubuntu 18.04 LTS. Prerequisites
Update Ubuntu 18.04First, update the list of packages:
Next, install the updates:
Create your sudo userUbuntu ships with
You will be asked to set information about this user:
You can fill these fields in, or press ENTER to leave them default. After this press Y and then ENTER to verify that the information is correct. Next, add the new user to the
You can now log out, and log back in as your new user. To test that the user was added correctly, use the following command once you have logged back in as the new user:
You will receive the following notice:
When you append the previous command with
You can now move onto updating Ubuntu. Install a webserverYou can use Apache or Nginx as your webserver. To install and start Apache:
To install and start Nginx:
PHP 7.2 is included in the default Ubuntu repository for 18.04. You can list each of the available PHP 7.2 packages with the following command:
Next, install the packages that your application requires:
Finally, restart your webserver to allow PHP to run. For Apache, use the following:
Alternatively, use the following for Nginx:
Confirm the PHP version:
The output will resemble the following:
The main config file of PHP 7.2 will be saved as
Note: Remember to restart Apache or Nginx if you make any changes to that file or any other PHP config files. You have successfully set up PHP 7.2 on Ubuntu 18.04 to work with either Nginx or Apache. You are now ready to customize your configurations and deploy your apps. Want to contribute?In this tutorial, we will show you how to install PHP 7.2 on Ubuntu 16.04. PHP (Hypertext Preprocessor) is an open-source server-side scripting language designed primarily for creating dynamic interactive websites. PHP is one of the most popular languages and it is freely available for redistribution and modifications. PHP can be run on almost any web server ( e.g. Nginx, Apache) and every OS platform (Linux, Mac OS, Windows). PHP 7.2 has been officially released last year and it is available for all RoseHosting clients. The latest PHP 7.2 release has new and improved features and functions that will allow developers to write better code.Table of Contents 1
Requirements:
Step 1: Connect to your server via SSH and update your server OS packagesBefore we begin, let’s connect to your VPS via SSH as user root and update your Ubuntu OS packages to the latest available version. To connect to your server via SSH as user root, use the following command: ssh root@IP_ADDRESS -p PORT_NUMBER Replace “IP_ADDRESS” and “PORT_NUMBER” with your actual server IP address and SSH port number. Once logged in, make sure that your server OS packages are up-to-date by running the following commands: apt-get update apt-get upgrade If this is your first time logging into your brand new Ubuntu VPS, you can also check our First Steps After Getting An Ubuntu VPS tutorial for some additional basic initial server setup and security tips. Step 2: Install a Web ServerIn this section, we will show you how to install a web server on your VPS. We can install Apache, or nginx as a web server. For the purpose of this tutorial, we will install the Apache web server. Apache is a fast and secure web server and one of the most popular and widely used web server in the world. To install the Apache web server, run the following command on your server: apt-get install apache2 After the installation is complete, you should start Apache: systemctl start apache2 Also, you can enable Apache to start automatically on server boot: systemctl enable apache2 To check the status of the Apache web server and make sure it is up and running, you can use the following command: systemctl status apache2 To verify that Apache is running, you can also open your web browser and enter your server IP address, (e.g. http://your_server_ip_address). If Apache is successfully installed, you should see the Apache default welcome page. Step 3: Install Ondřej Surý’s PPAPHP 7.2 can be installed using Ondřej Surý’s PPA, so install the software-properties-common and python-software-properties packages: sudo apt-get install software-properties-common python-software-properties Then, add the ondrej PPA and update your sources: sudo add-apt-repository -y ppa:ondrej/php sudo apt-get update Step 4: Install PHP 7.2Install PHP 7.2 using the following command: sudo apt-get install php7.2 php7.2-cli php7.2-common Step 5: Search and install specific PHP 7.2 extensionsIf you want to install a specific PHP 7.2 extension, you can search if it is available using the following command: sudo apt search php7.2 Step 7: Install most commonly used PHP extensionsTo install the most commonly used PHP extensions you can use the following command: sudo apt-get install php7.2-curl php7.2-gd php7.2-json php7.2-mbstring php7.2-intl php7.2-mysql php7.2-xml php7.2-zip Step 8: Check the PHP installationUse the following command to check the PHP version installed on your server: php -v You should receive the following output: PHP 7.2.9-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Aug 19 2018 07:16:12) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.9-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies Now, PHP 7.2 has been installed on your Ubuntu server, and if we want to change the default PHP version to PHP 7.2 that is used by the web server, we need to disable the old PHP 7.0 version and enable the newly installed one. Disable PHP 7.0a2dismod php7.0 Enable PHP 7.2a2enmod php7.2 Restart the Apache web server for the changes to take effect: systemctl restart apache2 To test your installation and check that Apache, PHP and PHP extensions are working properly, create a new php info file: vi /var/www/html/phpinfo.php Add the following content to it: Open the ‘phpinfo.php’ file using a web browser: http:// and view the current information about PHP on your
server. Of course, you don’t have to install PHP 7.2 on Ubuntu 16.04, if you use one of our Managed PHP 7.2 Hosting services, in which case you can simply ask our expert system administrators to install PHP 7.2 on Ubuntu 16.04 for you, using the LAMP or LEMP stack or any other web hosting stack of your choice. They are available 24×7 and will take care of your request immediately. For more updates, you can also consider reading our guide on How to Install PHP 8 on Ubuntu 20.04. PS. If you liked this post, on how to install PHP 7.2 on an Ubuntu 16.04 server, please share it with your friends on the social networks using the buttons below or simply leave a comment in the comments section. Thanks. |