• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » Install PHP 7.2 on Ubuntu 18.04 LTS Running Apache2, Percona MySQL

By Abhishek Ghosh May 25, 2018 10:45 pm Updated on April 14, 2020

Install PHP 7.2 on Ubuntu 18.04 LTS Running Apache2, Percona MySQL

Advertisement

In our previous guides, we installed Percona MySQL 5.7 on Ubuntu 18.04, then installed Apache2 with Let’s Encrypt and enabled HSTS, HTTP/2. Now, We Will Install PHP 7.2 on Ubuntu 18.04 LTS Running Apache2, Percona MySQL. That will create a typical LAMP server setup, enough to run PHP-MySQL web applications like WordPress. This tutorial can be used for cloud server, VPS, dedicated server. Dedicate server’s optimization only will differ.

Updates :

This article is for configuring APC.

Advertisement

---

This guide is an update to this article for installing PHP 7.4.

 

Steps to Install PHP 7.2 on Ubuntu 18.04 LTS

 

We will use Ondřej Surý’s PPA :

Vim
1
2
3
4
5
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
# hit enter key
apt update
apt upgrade

After that part is complete, simply run :

Vim
1
sudo apt-get install php

By default, latest PHP will be installed. After installation is complete, run :

Vim
1
php -v

Which will return this kind of output :

Vim
1
2
3
4
PHP 7.2.5-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: May  5 2018 05:00:15) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.5-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Now, we have to install some of the PHP modules to run most of the PHP-MySQL applications, or WordPress with different plugins :

Vim
1
apt install libapache2-mod-php7.2 php7.2-cgi php7.2-cli php7.2-common php7.2-curl php7.2-dev php7.2-gd php7.2-gmp php7.2-json php7.2-mysql php7.2-opcache php7.2-pgsql php7.2-pspell php7.2-readline php7.2-recode php7.2-sqlite3 php7.2-tidy php7.2-xml php7.2-xmlrpc libphp7.2-embed php-symfony-polyfill-php72 php7.2-bcmath php7.2-bz2 php7.2-mbstring php7.2-xsl php7.2-zip

It will take some time. You can search modules for PHP 7.2 by running :

Vim
1
sudo apt-cache search php* | grep 7.2

We actually installed most of them. Now go to your public HTML directory and create a PHP info page, like :

Vim
1
2
cd /var/www/html
nano info.php

Copy paste this in that file :

Vim
1
<!--?php // Show all information, defaults to INFO_ALL phpinfo(); ?-->

Save the file. Open browser and point to that info.php, file on browser, which will show you an informative page :

Install PHP 7.2 on Ubuntu 18.-4 LTS Running Apache2 Percona MySQL

Do not forget to delete that php.info file :

Vim
1
2
3
4
cd /var/www/html
rm info.php
## one line command
# sudo bash -c "echo -e '<!--?php\nphpinfo();\n?-->' &gt; /var/www/html/info.php"

Update Ubuntu search database by running :

Vim
1
sudo updatedb

Then search PHP settings file :

Vim
1
locate php.ini

There are lot of PHP ini files, which will be used by your web application? We can run :

Vim
1
php -i | grep ini

You’ll get output like this :

Vim
1
2
3
4
5
Configuration File (php.ini) Path =&gt; /etc/php/7.2/cli
Loaded Configuration File =&gt; /etc/php/7.2/cli/php.ini
Scan this dir for additional .ini files =&gt; /etc/php/7.2/cli/conf.d
Additional .ini files parsed =&gt; /etc/php/7.2/cli/conf.d/10-mysqlnd.ini,
...

Actually, /etc/php/7.2/cli/php.ini is for CLI. See that php.ini file on browser, there it is written :

Loaded Configuration File /etc/php/7.2/apache2/php.ini

So, essentially we have to tweak, optimize both files. Now install APCu :

Vim
1
pecl install apcu

We are creating the settings file of APCu (alternatively, you can open /etc/php/7.2/mods-available/cache.ini and add extension=apcu.so ) :

Vim
1
echo "extension=apcu.so" | tee -a /etc/php/7.2/mods-available/cache.ini

And make a symlink :

Vim
1
ln -s /etc/php/7.2/mods-available/cache.ini /etc/php/7.2/apache2/conf.d/30-cache.ini

Now restart Apache :

Vim
1
systemctl restart apache2

APCu makes codes faster by caching. Alternate method of installing APCu (example is for PHP 7.4) :

Vim
1
sudo apt-get install php7.4-apcu

You can read further settings :

Vim
1
http://php.net/manual/en/apcu.configuration.php

This is basic setup. You can search our website for PHP’s caching optimization with keywords like en Opcache, Opcache etc. But this much is basic need. Some settings of PHP ini also need minimum change to increase upload limit via PHP-MySQL applications.

Tagged With ubuntu php , https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1821 tWPQ2h8aWgJPqEz72jH4ahU4vl67eQayr1oL971qu5De9IxIrc1UfzicT8nEiBJR 5751e4149273b0333ed3386d38ba066284c0da48&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme , https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1836 cfx9PGRP6pjiLYmGOTSWZQcdyhB0C5ICbY8U7WFHJBgeJ6fdmLuAIMmLkqT73T5D 50617ded7e5c02d8bfa5c3250c2077757e3eee30&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme , https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1837 xUvf6DFOvxceTWJinKOjOhTQEx5S96YKF3QGyLAn7CkzgWukB1VBATJGmszGVGsq 4acd4ec050642716350b283190bbbcade72fbd1f&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme , install php 7 2 ubuntu 18 , paperuri:(43b2945e81ac1d056ed66e4a2c7c506d) , Ubuntu 18 LTS APCu , Ubuntu下源码安装MySQL , unbuntu 18 04 extensions PHP 7 2

This Article Has Been Shared 779 Times!

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Install PHP 7.2 on Ubuntu 18.04 LTS Running Apache2, Percona MySQL

  • Cheap Cloud & Virtual Servers For Running Apache Big Data Tools

    Here Are Some Points For Selecting Correct Servers For Running Apache Big Data Tools. Of Course We Are Talking About So Called Low End Box.

  • How to Install, Configure, Secure MongoDB on Ubuntu 16.04 LTS

    MongoDB is a Modern, Lightweight, Scalable NoSQL Database. Here is How to Install, Configure, Secure MongoDB on Ubuntu 16.04 From SSH.

  • Steps to Install Percona MySQL Server on Ubuntu 18.04 LTS

    Here is Latest, Tested Steps to Install Percona MySQL Server on Ubuntu 18.04 LTS For Cloud Server, VPS and Dedicated Server.

  • Analysis of Jenkins for DevOps : Part I

    This is Part I of Series Analysis of Jenkins for DevOps. Jenkins is a software system developed for maintaining collaboration, quality management, agility.

  • How to Connect Apache Kafka With MQTT

    We Can Connect Apache Kafka With MQTT in Different Ways With Different Types of Available Connectors, Including Connectors Based on REST API.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Get Audiophile-Grade Music on Your Smartphone March 25, 2023
  • Simple Windows Security and Privacy Checklist for 2023 March 24, 2023
  • 7 Best Artificial Intelligence (AI) Software March 24, 2023
  • ESP32 Arduino Water Tank Level Monitoring Using Laser ToF Sensor March 23, 2023
  • Exploring the Benefits and Advantages of Microsoft’s Operating System March 22, 2023

About This Article

Cite this article as: Abhishek Ghosh, "Install PHP 7.2 on Ubuntu 18.04 LTS Running Apache2, Percona MySQL," in The Customize Windows, May 25, 2018, March 25, 2023, https://thecustomizewindows.com/2018/05/install-php-7-2-on-ubuntu-18-04-lts-running-apache2-percona-mysql/.

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT