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:
- Creating a Web Application in Python
- Learn to Make Web with Nodejs for Beginners
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.
(read also: 6 Text Based Text Editor (CLI) on Linux for Writing Code )
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.
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:
Which version should I install?
I recommend installing the latest, ie
PHP 7.x. Because PHP 5.x will soon end its support period.
On Ubuntu 16.04 and Linux Mint 18.2, PHP 7 can be installed with the command:
sudo apt install php
After that, don't forget to install public libraries that are often needed.
sudo apt install libapache2-mod-php php-mysql php-common
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 command
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
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.
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
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:)
Enter the password again:
Don't forget to check the MySQL version installed with the command
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
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
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 .
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:
Enter the password again:
After successfully installing, try checking to http: // localhost / phpmyadmin . Then, enter with a password that was created.
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
root. Please 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';
passowordwith the username and password you want.
Then we give the same permissions as
rootwith this command:
GRANT ALL PRIVILEGES ON * . * TO 'admin'@'localhost';
After that type the following command to reload access:
If you experience difficulties, try watching this video:
If you get a problem like this:
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