
Many use XAMPP to learn web programming, both on Windows, Linux, and MacOS.
But I actually prefer to use a server installed from a separate package , because it feels like assembling a real server.
Just install:
apt install apache2 mysql-server php libapache2-mod-php php-mcrypt php-mysql phpmyadmmin
Sounds more complicated indeed, but it will add to our insight into server configuration.
For those who don't want to bother, you can use XAMPP.
What is XAMPP?
XAMPP is an application package which contains web server, PHP, MySQL, Phpmyadmin, perl, curl, and other programs to support web development.
XAMPP can now be used on Windows, Linux, and Mac.
Download and Install XAMPP

Choose PHP 7, because PHP 5 will soon be extinct. 

After the download is complete, we will get a binary file.

We will execute this file with the user
root
. Therefore, let's open the file manager as root
. Then, click 2x on the file.
Then a window will appear like this.

Click next to continue.
We will be asked to determine which components will be installed. Leave it like this:

Then click next .
XAMP will be installed in the directory
/opt/lampp/
, click next to continue.
Click next again.

Once again, click next to start the installation ...

... and wait until the process is complete

Click finish to end and open XAMPP.

Operate XAMPP
Now try going to the Manage Servers tab , then turning on the Apache web server service by clicking the start button .


Congratulations
Webserver is going well.
Anyway, in some distributions, XAMPP is not on the menu. To reopen XAMPP, we must execute the file
/opt/lampp/manager-linux-x64.run
as root
.
Get to know the htdocs directory
Directories
/opt/lampp/htdocs
are directories where we put web files likehtml
and php
. This file will later be accessed via the http: // localhost / address .
For example:
We put the file
/opt/lampp/htdocs/webku.php
, then how to open it in the browser is with the address http: //localhost/webku.php .
However, for now, it's only
root
possible to write files there. So that all users can write there, we must give access rights.
Type the following command in the terminal to give access rights to write files to all users.
sudo chmod 777 /opt/lampp/htdocs/ -R
Now let's make a file called
hello.php
.
Then try opening the browser: http: //localhost/hello.php

Congratulations
this is the first PHP program that we created in XAMPP.
Lack of XAMPP
There are some disadvantages that I feel at XAMPP:
- Cannot open interactive php .
- Commands
php
and aremysql
not recognized in the terminal, because they have not been added to the environment variable . - If you want to open Xampp, you have to open the directory
/opt/lampp
first, unless the shortcut is created. - XAMPP on Linux is not directly integrated with menus such as Windows and Mac.
Reference: https://www.petanikode.com/php-xampp/
0 Komentar untuk "Web Programming on Linux with XAMPP"
Silahkan berkomentar sesuai artikel