In this series you will learn how to use PHP to perform attacks, gather information, and setup backdoors. Along with performing attacks you will learn how to protect yourself from them. In this part you will learn about PHP as well as install Apache and PHP.
What you'll need for this series
- Text editor(Any will work)
- Browser(Any will work)
- Apache web server with PHP(We set that up in this part)
What Is PHP?
PHP is a server-side scripting language. All code written in PHP is executed exclusively on the server. The client never sees the code which is why most attacks in this series will be on a server.
Finding Your IP Address
Throughout this series I will use "yourip" in place of your IP address. If you are using a browser on the same system you are hosting the Apache server on, just replace "yourip" with "localhost" or "127.0.0.1". Otherwise you will need to know your local IP address. To find your local IP address, run the following command.
ifconfig | grep 'inet addr:'
Your local IP addres is the IP address next to "inet addr:" on the line that doesn't contain "127.0.0.1".
Step 1: Setting Up Apache
To Install Apache run the following command.
sudo apt-get install apache2
After running the command you will be asked if you want to continue.
Select "Yes"
Let Apache finish installing.
Step 2: Making Sure Apache Works
Open a browser and navigate to "http://yourip". You should see a page similar to the one in the image bellow.
Now that we know Apache works we can install PHP!
Step 3: Setting Up PHP
To Install PHP run the following command.
sudo apt-get install php5 libapache2-mod-php5
After running the command you will be asked if you want to continue.
Select "Yes"
Let PHP finish installing.
In order for PHP to work you need to restart Apache. To restart Apache run the following command.
sudo service apache2 restart
Step 4: Making Sure PHP Works
Create a file called "test.php" and place it in your public html folder (usually located at "/var/www/" or /var/www/html"). We need to run some PHP code to make sure that PHP was installed properly. I will be using the code bellow which returns a page with the PHP version we installed and "Hello,World!".
//+-----------------------------------------------------------------------------------+
<?php
$version=phpversion();//sets $version to curent php version
echo 'version: '.$version;//prints "version: x.x.x" to the page
echo '<br/>';//prints a new line to the page
echo 'Hello, World!';//prints "Hello, World!" to the page
?>
//+-----------------------------------------------------------------------------------+
Open a browser and navigate to "http://yourip/test.php". You should see a page similar to the one in the image bellow.
Congratulations you have a working Apache2 web server with PHP!
Conclusion
You now have a fully functional Apache web server with PHP! You have everything you need to follow along with this series. If you have any comments, trouble, or questions please leave a comment bellow.
Just updated your iPhone to iOS 18? You'll find a ton of hot new features for some of your most-used Apple apps. Dive in and see for yourself:
5 Comments
good tutorial, I am looking forward to future tutorials!
Thank you!
You have a typo in step three:
"
Step 3: Setting Up PHP
To Install PHP run the following command.
sudo apt-get install php5 libapache-mod-php5
"
libapache2-mod-php5 ; Good thing you had the image attached.
Waiting for the rest :D
Fixed, Thank you!
Good'ol LAMP
Share Your Thoughts