Fix PHP Not Rendered on Ubuntu LAMP Server
0

So Ubuntu has gotten more recent update that is major it version 16.0 which also known as Xenial Xerus. Some people also say that this new update is the ubuntu release that is best up to now. In this essay We demonstrate just how to install Apache that is full stack it. We will have Apache, MariaDB, and of course the version that is fastest of PHP, the PHP 7 – this setup can be called LAMP Stack. Often the abbreviation is short for Linux, Apache, MySQL and PHP in this guide we’ll change traditional MySQL host along with its drop-in replacement, MariaDB host to provide better and much more performance that is sleek handling your apps’ database.

Also read : How to setup nginx with HTTP/2 and free SSL at Ubuntu.

Prerequisites

  1. A SSH client like Bitvise or Putty and knowledge that is basic utilizing it.
  2. Basic information about typical Unix demand to SSH towards host.
  3. A host or VPS with at the least 256MB of RAM (OpenVZ) but 512MB is preferred if you use KVM or Xen.
  4. About 30 moments of your energy.
  5. a sit down elsewhere or tea.

Confused on selecting which VPS provider to put together an Apache based server that is hosting? Read my recommended VPS providers or this list of top end that is low host providers. Quick suggestion: Digital Ocean, Atlantic.net or Ramnode.

In this guide i’m making use of a 512MB RAM Cloud VPS from Atlantic operating Ubuntu 16.04 x64.

Do remember to constantly change domain.tld with your personal domain title and replace x.x.x.x together with your host ip.

Provision a cloud host

Step 1 – Login to Atlantic.net > select Servers > Add Server.

2016-04-17_210817

Step 2 – provide your host a name and select where location you need that it is hosted at. Presently, Atlantic.net has 6 locations that are different: New York, Dallas, Orlando, San Fransisco, Toronto (CA), and London (UK).

Create A Server on Atlantic

Step 3 – Choose Ubuntu 16.04 as the operating system for your cloud vps.

Ubuntu 16.04 Atlantic Server

Step 4 – Decide which plan you want (and you need).

Choose VPS Plan

Step 5 – Finally, click on the Create Server button.

2016-04-17_211935

Step 6 – The process should take less than 1 minute to complete.

building cloud server

Step 6 – Once done, the login details will be emailed to your inbox.

Check Email

Step 7 – Login to your server via Putty.

Login Putty

Step 8 – Type this command to change default Hostname. Use FQDN that is proper hostname:

hostname host.domain.tld
 
 ## instance :
 hostname atlantic.servermom.org

Change Hotsname Ubuntu

Step 9 – Close Putty and re-login making use of session that is new you should now see it has changed. It is also a practice that is good alter provided root password with your personal.

relogin putty

Install Apache

Step 1 – as always, setting up Apache webserver on Ubuntu can be as as simple simple. Automagically, Ubuntu has included the package which is obtainable in standard repository. Simply problem command that is following********)

apt-get install apache2

Do not forget to always answer Y when asked.

install apache2 ubuntu 1604

Step 2 – Now let’s enable Apache2 service and start it.

systemctl enable apache2
 systemctl start apache2

enable start apache2 ubuntu 1604

Step 3 – Verify the status of Apache whether it has run properly or not.

systemctl status apache2

Verify Apache2 Status

Step 4 – Open up your web that is favorite browsere.g: Firefox) and access your host through ip. You ought to then see Apache’s standard web page such as this one :

Apache Ubuntu Default Page

You may read that web page because it contains very useful basic information about Apache on Ubuntu.( if you want********)

Install MariaDB Server

Assuming that you use fresh Ubuntu server, so go straight forward i’ll utilizing the actions. Otherwise, then you have to firstly stop and remove its service.( if you have MySQL running********)

Step 1 – Again, we can simply use command that is apt-get its package will come in standard repository.

apt-get install mariadb-server

install mariadb ubuntu 1604

Step 2 – throughout the procedure, perhaps you are expected to enter database root password. Keep in mind, database root individual isn’t exactly like your host root individual. Consequently, it will always be a idea that is good have different password set for each. However, then you can simply issue following command :

mysql_secure_installation

Step 3 – You’ll be asked to answer a series of questions.

Enter current password for root (enter for none):  <-- Just hit enter because we don't have any password
 Set root password if the system does not ask you to define database root password for MariaDB? [Y/n] y <-- response Y and strike enter
 brand new password: <-- key in your password right here
 re-enter password that is new <-- type in again
 Remove anonymous users? [Y/n] <-- just hit enter
 Disallow root login remotely? [Y/n] <-- just hit enter
 Remove test database and access to it? [Y/n] <-- just hit enter
 Reload privilege tables now? [Y/n]  <-- just hit enter

See this screenshot pic :

mariadb first setup configuration

mariadb first setup configuration 2

Step 4 – Let’s check the status of your newly installed MariaDB server.

service mysql status

You should see no error that is critical. But in rare circumstances it’s also possible to see this problem********) that is:(*****)mariadb server error

error message :

mariadb server error message

[Warning] ‘user’ entry ‘[email protected]’ has both a password and an authentication plugin specified.

The follow this step that is additional********)

Try to login to MariaDB host as root but without password. Effective login means the basis password you’ve got specified prior to isn’t place that is taking.

mysql -u root
 
 use mysql;
 update user set plugin='' where User='root';
 flush privileges;
 q

fixing mariadb error ubuntu 1604

Next, issue this command again and follow the steps thoroughly:

mysql_secure_installation

Install PHP7

Step 1 – it, let’s firstly update your apt database :

apt-get update -y

Step 2 – Now let’s install PHP7 on your Ubuntu 16.04 server plus few of its common PHP7 modules:

apt-get install php7.0-mysql before we install php7.0-curl php7.0-json php7.0-cgi php7.0

install php7 ubuntu 1604

The demand above will immediately install packages that are following php7.0, libcurl3, php-common, php7.0-cli, php7.0-common, php7.0-opcache, php7.0-readline, php7.0-cgi, php7.0-curl, php7.0-mysql, and soon.

Step 3 – Verify that you have truly installed php 7 by issuing this command :

php -v

You’ll then get following message :

PHP v7.0.4

as you can see above, in my case it is PHP v7.0.4.

Step 4 – Now create a PHP test file :

nano /var/www/html/testphp.php

Step 5(*******)– put this code then :

<?php
 phpinfo();
 ?>

Do remember hitting Control+O to truly save the file and Control+X to leave Nano editor.

php test file

Step 6 – Now start your web browser up again and try accessing that file :

http://x.x.x.x/testphp.php

Step 7 – You should now see detailed PHP information page. What if I got a page that is blank? Then the.php is meant by it file you’ve just created is not rendered and PHP is not working properly. Now install this php that is additional :

apt-get install libapache2-mod-php

libapache2-mod-php7.0 module

Now restart apache2 solution and test it once more in your web browser

service apache2 restart

PHP7 Installed Succesfully

Next : Install phpMyAdmin on Ubutu 16.04 LAMP Server

That’s all. With this true point your server is basically ready to use. What’s next to do is simply creating hosts that are virtual to include your internet site about it. We’ll discuss that an additional article. But you can simply read my previous similar article about the same goal but was done on older Ubuntu version if you want. Anyhow, don’t neglect to follow me personally on twitter for faster upgrade or subscribe together with your e-mail.

Just how to Install Java 9 in Debian and Ubuntu techniques

Previous article

The Ionic Adidas Edition is Fitbit’s response to the Apple Watch Nike+

Next article

You may also like

Comments

Leave a reply

Your email address will not be published. Required fields are marked *

More in advance