Header Banner
Null Byte Logo
Null Byte
wonderhowto.mark.png
Cyber Weapons Lab Forum Metasploit Basics Facebook Hacks Password Cracking Top Wi-Fi Adapters Wi-Fi Hacking Linux Basics Mr. Robot Hacks Hack Like a Pro Forensics Recon Social Engineering Networking Basics Antivirus Evasion Spy Tactics MitM Advice from a Hacker

Web Development 01 - Setting Everything Up

Global network symbol next to server racks.

Hello fellow Null-Byters! This is my first post so please be respectful and constructed criticism is much appreciated. I am no professional, however I believe that it is important to understand technologies before you go poking at them and trying to break them, I therefore decided to make this series. In this "tutorial" we are going to setup a web server with php and mysql. I will be doing this with a raspberry pi because a pi is quite versatile.

Installing Apache with PHP

We are going to be setting up an Apache2 server. We are using apache because it is easy to setup and is great at hosting static files. Go into a terminal/command prompt and enter in the command: sudo apt-get install apache2 php5 libapache2-mod-php5

Web Development 01 - Setting Everything Up

It will install and if there are any errors try using: sudo apt-get update && sudo apt-get upgrade. Then try again

Installing Apache with PHP on Mac

Follow this guide on how to enable it with PHP. You can also use another service called MAMP which I would highly suggest you use. It is a plug and play kind of product and it comes with MySql as well.

Installing Apache with PHP on Windows

Once again, follow a guide here. There are also alternatives that you can chose from listed on that site.

Install MySql

Now, we need to install MySql. We will get more in depth in a later tutorial. To go ahead and install, type the command: sudo apt-get install mysql-server --fix-missing

Code snippet displayed on a dark background.

A successful install will look like such. It will also ask you to set a root password then confirm it.

Web Development 01 - Setting Everything Up

Then after that, type the command: sudo apt-get install mysql-client php5-mysql

Web Development 01 - Setting Everything Up

This actually installs the client.

Connect to It

Everything should be setup and ready to go. Connect to your local ip address by using hostname -I. You should see this pop up:

Default web page indicating the server is active.

or

Apache2 Debian Default Page with configuration options and instructions.

Congratulations! You just setup a web server. All the source files are in /var/www/http. Unless you chmod or chown all these files, USE SUDO FOR EVERYTHING.

Testing the PHP

Now we need to test the PHP installation. Go ahead and delete index.html and then open another file named index.php

Terminal commands for file execution and editing in a web development context.

In this new file type this:





Test Webserver





Code snippet displaying HTML structure with a PHP function for server information.

I'll explain all this later but you should then see something like this:

PHP version information screen displaying version 5.5.14.

Other Tools Use

If you decided to use tools such as MAMP, google around and find a quick intro that can get you up and running in secs. After this, all the concepts should be the same.

Notes

Once again, this is my first post so please be respectful. In the next couple tutorials we will be going over important information that you need to know before we get programming.

You already know how to use your phone. With Gadget Hacks' newsletter, we'll show you how to master it. Each week, we explore features, hidden tools, and advanced settings that give you more control over iOS and Android than most users even know exists.

Sign up for Gadget Hacks Weekly and start unlocking your phone's full potential.

Related Articles

Comments

No Comments Exist

Be the first, drop a comment!