Blog for Learning

| lesson material | material summary | questions and answers | definitions | types and examples | other information | materi pelajaran | ringkasan materi | pertanyaan dan jawaban | definisi | jenis-jenis dan contoh-contoh | informasi lainnya |

Powered by Blogger.

6 Tools that must be prepared for Learning Web Programming (PHP) on Linux

Web programming with PHP on Linux
What are the applications needed for web programming on Linux?
The answer: depends on the language to be used.
Usually the language commonly used is PHP.
Besides PHP, we also use Python, Java, Ruby, C #, and so on.
In this paper, we will use PHP ...
For other languages, please read here:
Then for the tools we need for PHP programming on Linux are as follows:

1. Text Editor

We will use the Text Editor to write code.
There are many choices of text editors on Linux such as: Gedit, Geany, Atom, Sublime, CodeLite, etc.
Choose a text editor that you like.
I myself use VS Code , because it's quite complete and easy to use.
Text editor VS Code for writing PHP code

2. Browser

We must install this program, because we will use it to see the results of the web code written.
There are many browser options under Linux: Google Chrome, Firefox, Opera, etc.
Choose a browser that you like.
Mozilla Firefox browser on Linux Mint

3. PHP

In order for the PHP code to be executed, we need a PHP interpreter. The interpreter is responsible for translating PHP code so that it is understood by the computer.
There are two versions of PHP that are currently edited: PHP 5.xandPHP 7.x
Which version should I install?
I recommend installing the latest, ie PHP 7.xBecause PHP 5.x will soon end its support period.
Period of PHP support
On Ubuntu 16.04 and Linux Mint 18.2, PHP 7 can be installed with the command:
sudo apt install php
Then, type yto continue:
Install PHP 7 on Linux
After that, don't forget to install public libraries that are often needed.
sudo apt install libapache2-mod-php php-mysql php-common
Information:
  • package libapache2-mod-phpneeded by Apache2 server;
  • the package php-commoncontains several libraries that are often needed;
  • package is php-mysqlneeded for PHP connection with MySQL .
After that, to make sure PHP is installed correctly. Try typing the commandphp -v:
Check the version of PHP installed

4. Web Server (Apache)

Actually PHP has brought its own web server , so Apache doesn't really need to be installed.
But, because we want to use PHPMyAdmin, we have to install it.
Please type the following command to install the Apache server on Linux:
sudo apt install apache2
After that, try checking the installed version with the command apache2 -v.
The Apache version installed
Then how to operate this Apache server?
If you use XAMPP, we just click start, then Apache2 service will run.
Well, if on Linux, we can use this command to turn on Apache service:
sudo service apache2 start
The command to stop the apache server:
sudo service apache2 stop
The command to restart:
sudo service apache2 restart
Command to view server status:
sudo service apache2 status
In addition, we can also open the http: // localhost address to check whether the apache server is running or not.
If it looks like the following, the server is running.
Test the Apache server via the browser
Don't forget to set the access rights of the server directory, so that ordinary users are free to create files and directories there.
sudo chmod 777 /var/www/html -R

5. Database Server (MySQL)

When we are going to create more complex applications, we need a database to store the data.
Usually, the database used is MySQL. Besides MySQL, there are also PostgreSQL, Mongodb, SQLite, etc.
We will use MySQL only.
Please type the following command to install MySQL on Linux.
sudo apt install mysql-server
Type yto continue:
Install MySQL
In the installation process, we will be asked for a password for the root user in MySQL.
Please enter a password that is easy to remember (example:) kopi.
Creating a mysql root password
Enter the password again:
Password Confirmation
Installation complete.
Don't forget to check the MySQL version installed with the command mysql --version.
Check the installed version of MySQL
How to operate it is the same as running Apache service.
sudo service mysql start # menayakan service
sudo service mysql stop # menghentikan service
sudo service mysql restart # menyalakan ulang service
sudo service mysql status # melihat status server

6. PHPMyAdmin

PHPMyAdmin will be used to manage MySQL databases easily. Because it has a web-based GUI display.
Besides using PHPMyAdmin, we can also use other applications such as MySQL Workbench, Navicat, etc.
Please type the following command to install PHPMyAdmin on Linux:
sudo apt install phpmyadmin
Type yto continue:
Install PHPmyadmin on Linux
In the installation process we will be asked to determine the server type and password for root.
Please press the button Spasito select Apache2 server .
Choose a Web server
An asterisk ( *) means we are choosing Apache2 .
Why do we have to choose Apache2 ?
Because we installed Apache2 as the web server.
Next we will be asked to configure PHPMyAdmin. Please select Yes then press Enter.
Then enter the password for the PHPmyadmin root user. We equate their password with mysql password, namely: kopi.
Make a phpmyadmin password
Enter the password again:
Make a phpmyadmin password
After successfully installing, try checking to http: // localhost / phpmyadmin . Then, enter with a password that was created.
Log in to phpmyadmin
Well, everything has been prepared.
If there is no error until this stage, it means we have successfully prepared all the tools needed to program the web on Linux.
Next, we can start creating a web.

Update: MySQL 5.7

In MySQL version 5.7, the root user cannot be used to log in to phpmyadmin.
How to solve this problem:
We can create a new user who has the same access as rootPlease follow the steps below.
Enter the MySQL shell first with the command:
sudo mysql -u root
After that, create a new user with this command:
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password';
Affirm:
Please change adminand passowordwith the username and password you want.
Then we give the same permissions as root with this command:
GRANT ALL PRIVILEGES ON * . * TO 'admin'@'localhost';
After that type the following command to reload access:
FLUSH PRIVILEGES;
If you experience difficulties, try watching this video:

Troubleshooting PHPmyadmin

If you get a problem like this:
phpmyadmin error
Try installing libapache2-mod-php:
sudo apt install libapache2-mod-php
After that, restart the Apache2 server:
sudo service apache2 restart
Still not able?
Try doing this:
Reconfigure phpmyadmin with the following command:
sudo dpkg-reconfigure -plow phpmyadmin
Still can't too?
hmmm ... try checking the following references:
0 Komentar untuk "6 Tools that must be prepared for Learning Web Programming (PHP) on Linux"

Silahkan berkomentar sesuai artikel

 
Copyright © 2015 - 2024 Blog for Learning - All Rights Reserved
Template By Kunci Dunia
Back To Top