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.
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
It will install and if there are any errors try using: sudo apt-get update && sudo apt-get upgrade. Then try again
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.
Once again, follow a guide here. There are also alternatives that you can chose from listed on that site.
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
A successful install will look like such. It will also ask you to set a root password then confirm it.
Then after that, type the command: sudo apt-get install mysql-client php5-mysql
This actually installs the client.
Everything should be setup and ready to go. Connect to your local ip address by using hostname -I. You should see this pop up:
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.
Now we need to test the PHP installation. Go ahead and delete index.html and then open another file named index.php
In this new file type this:
<?php phpinfo() ?>
I'll explain all this later but you should then see something like this:
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.
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.
Want to start making money as a white hat hacker? Jump-start your hacking career with our 2020 Premium Ethical Hacking Certification Training Bundle from the new Null Byte Shop and get over 60 hours of training from cybersecurity professionals.
Other worthwhile deals to check out: