{"id":5804,"date":"2018-12-15T04:28:54","date_gmt":"2018-12-15T04:28:54","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=5804"},"modified":"2018-12-28T21:02:01","modified_gmt":"2018-12-28T21:02:01","slug":"how-to-install-php-7-2-on-ubuntu-18-04","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/12\/15\/how-to-install-php-7-2-on-ubuntu-18-04\/","title":{"rendered":"How to install PHP 7.2 on Ubuntu 18.04"},"content":{"rendered":"<h2>Install PHP on Ubuntu 18.04<\/h2>\n<p>PHP is one of the <em><u>most popular programming language<\/u><\/em> currently in the world. PHP has different versions <em><u>5.6, 7.0, 7.1 and 7.2.<\/u><\/em> Currently, PHP 7.2 is the latest version of PHP which supports different frameworks like WordPress, Laravel, Code-Igniter etc. Ubuntu 18.04 ships with <em>default PHP 7.2 support<\/em>, We can easily install PHP 7.2 on Ubuntu 18.4. Ubuntu 18.04 is the current latest version of Ubuntu. This tutorial outlines how to install PHP 7.2 on Ubuntu 18.04.<\/p>\n<h3>Prerequisites<\/h3>\n<p>Before you start installing PHP 7.2 on Ubuntu 18.04. You must have a non-root user account on your server with sudo privileges<\/p>\n<h3>1. Install PHP With Nginx<\/h3>\n<p><a href=\"https:\/\/www.nginx.com\/\">Nginx<\/a> does not support native PHP processing. You will need to Install \u201cfastCGI process manager\u201d which is known as php-fpm<\/p>\n<p>Run the following command to install php-fpm on your server. The following command will install php-fpm7.2<\/p>\n<p>sudo apt install php-fpm<\/p>\n<p>You can check the status where it is correctly installed or not by following command<\/p>\n<p>systemctl status php7.2-fpm<\/p>\n<p>After installing php-fpm package you will need to restart Nginx server. To restart Nginx server run following command<\/p>\n<p>sudo systemctl restart nginx<\/p>\n<p>You can check PHP version by running following command<\/p>\n<p>php -v<\/p>\n<h3>2. Installing PHP With Apache<\/h3>\n<p>If you have <a href=\"https:\/\/httpd.apache.org\/\">Apache<\/a> running at backend then we need to install PHP and Apache PHP module on the server. To install PHP 7.2 and Apache module type following command and press enter.<\/p>\n<p>sudo apt install php libapache2-mod-php<\/p>\n<p>After installing PHP and apache-php module you will need to restart Apache server by typing following command<\/p>\n<p>sudo systemctl restart apache2<\/p>\n<h3>3. Install PHP Extensions<\/h3>\n<p>You will need to install some basic PHP extensions to run WordPress , Laravel like frameworks on the server. To install any of the PHP extensions on the server following is the basic format.<\/p>\n<p>sudo apt install php-[name_of_the_extension]<\/p>\n<p>You can install curl extension for PHP by running following command<\/p>\n<p>sudo apt install php-curl<\/p>\n<p>Following are some basic PHP extensions needs to be installed on your server<\/p>\n<p>sudo apt install php7.2-curl php7.2-mysql php7.2-common php7.2-cli php7.2-gd php7.2-opcache<\/p>\n<p>To install more extensions you can use the above format.<\/p>\n<h3>4. Testing PHP processing<\/h3>\n<p>To test whether PHP is configured on your server properly or not you should create a file test.php inside directory var\/www\/html\/ with following code.<\/p>\n<p>&lt;?php<\/p>\n<p>phpinfo();<\/p>\n<p>If you see the following output then you have installed PHP successfully.<\/p>\n<h3>Conclusion<\/h3>\n<p>In this tutorial, you have learned how to install PHP 7.2 on Ubuntu 18.04 successfully with some of its basic extensions useful for frameworks and tested successfully. If you have any of the queries regarding this then you can comment below.<\/p>\n<h3>Related Tutorials<\/h3>\n<ol>\n<li><a href=\"https:\/\/linux4one.com\/how-to-install-nginx-on-ubuntu-18-04\">How to install Nginx on Ubuntu 18.04<\/a><\/li>\n<li><a href=\"https:\/\/linux4one.com\/how-to-secure-nginx-with-lets-encrypt-ssl-on-ubuntu-18-04\">How to Secure Nginx with Let\u2019s Encrypt SSL on Ubuntu 18.04<\/a><\/li>\n<\/ol>\n<p><a href=\"http:\/\/lxer.com\/module\/newswire\/ext_link.php?rid=263765\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install PHP on Ubuntu 18.04 PHP is one of the most popular programming language currently in the world. PHP has different versions 5.6, 7.0, 7.1 and 7.2. Currently, PHP 7.2 is the latest version of PHP which supports different frameworks like WordPress, Laravel, Code-Igniter etc. Ubuntu 18.04 ships with default PHP 7.2 support, We can &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/12\/15\/how-to-install-php-7-2-on-ubuntu-18-04\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to install PHP 7.2 on Ubuntu 18.04&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5804","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/5804","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=5804"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/5804\/revisions"}],"predecessor-version":[{"id":6424,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/5804\/revisions\/6424"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=5804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=5804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=5804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}