Skip to main content

Ubuntu, apache2, php7.0, mysql server and phpmyadmin



Today i installed Ubuntu 2016
on partion in the hard disk using somthing else option as following 
root>51200
boot>2048
home>357991
swap>8193 (must be the last one)
now i'm going to install apache2 to make local server
then
PHP 7.0 to program with this language and enable the local server to understand it
then
mysql server to make database
then
phpmyadmin to deal with the database
then
jdk and netbeans which is editor for java and php and other language and scripting programming



let's start

first of all i'm going to update
>sudo apt-get update

the next is that i'm going to install apache2
>sudo apt install apache2

now i'm going to test my local host
in the address of the browser i'm going to write
127.0.0.1
the page with title
Apache2 Ubuntu Default Page
appeared
that's good 

the next i'm going to install php 7.0
>sudo apt-get install php7.0

now let's make php file to test the php
>sudo vim /var/www/html/test.php

but i donot have vim program so i'm going to install it
>sudo apt install vim
now i can
>sudo vim /var/www/html/test.php

i pressed i to be in insertmood
type
<html>
<body>
<?php
   echo "Hello world from PHP file ";
 ?>
</body>

</html>
i pressed esc
to be in command mood
then i pressed :wq
to save what i wrote in the file

i went to : http://127.0.0.1/test.php

this open empty page
i  need to restart my apache

to restart the apache
>/etc/init.d/apache2 restart

still empty page
so i'm going to configure the apache and php with this commands

 >sudo a2enmod proxy_fcgi setenvif
 >sudo a2enconf php7.0-fpm
>/etc/init.d/apache2 restart

i went  to : http://127.0.0.1/test.php
i found the page i had written it compiled

now l's install netbeans from Ubuntu software
i'm installing plugins for php
from tools plugins . . . 
then
i'm going to install mysql server
>sudo apt-get update
>sudo apt-get install mysql-server
>sudo mysql_secure_installation
>sudo mysql_install_db //this commend did not working with me
>mysql -u root -p
then i wrote the password for database
 >show databases;
>exit;
>service mysql status
 i pressed q to exit the status
it's work good
now i'm going to install phpmyadmin
>sudo apt-get install phpmyadmin
i went  to : http://localhost/phpmyadmin/
this is not work (not found)

the next commend very important and i can make it by two ways
mathod 1 :
>sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-enabled/phpmyadmin.conf
method 2 :
after installing phpmy admin :
open the file and
>nano /etc/apache2/apache2.conf
Add the following to the bottom of the file:
phpMyAdmin Configuration >Include /etc/phpmyadmin/apache.conf
in the previous last line

now i need to restart apache
>/etc/init.d/apache2 restart
i opened : http://localhost/phpmyadmin/
i got Welcome to phpMyAdmin
that's all
Ahmed Helal Ahmed @ ITI

Comments