Jump to content
xisto Community
loramchugh

Gnu/linux Web Server With Apache2, Php, And Mariadb

Recommended Posts

This follows so closely on the heels of mastercomputers' tutorial about setting up a web server on a Red Hat-based GNU/Linux system because he used the term "Linux" to refer to the operating system as a whole, which raises my ire. I'm shaking my figurative fist at you, mastercomputers!

 

My version of the tutorial will show how to set up a web server on a Debian-based GNU/Linux system.

 

In the place of what is traditionally MySQL, I encourage people to start using MariaDB, because of a worry that Oracle is about to kill MySQL very soon.

 

MariaDB is a fork of MySQL created by the original creator of MySQL. Many of Oracle's MySQL developers have already left to join the MariaDB folks (much like the Oracle OpenOffice.org developers left to work on LibreOffice). Anyway, here's my tutorial.

 

Install Apache2

sudo apt-get install apache2

Install MariaDB

Use the MariaDB repository setup page to determine the correct repository to add to your system. In this example, I'm setting up MariaDB on Debian Wheezy.

 

Set up the repository

sudo apt-get install python-software-propertiessudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943dbsudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/debian wheezy main'

Update your apt sources and install MariaDB

sudo apt-get updatesudo apt-get install mariadb-server

Install PHP and the PHP module for Apache2

sudo apt-get install php5 libapache2-mod-php5

Share this post


Link to post
Share on other sites

I do agree with switching to MariaDB over MySQL but I don't think Oracle will kill the DB, just probably use it to help their own company out in some way.They have acquired a lot of content management companies, logistics and transportation, financials, social networks, etc I'm just waiting till they put out something that makes heads turn. Although, probably targetted at enterprises, so it's going to come with a hefty price tag.So from your steps, does these services start automatically?That's definitely targetted for easier use which is great. Although, knowing how to turn on and off a system would be good for the user too which is why making it too easy means they don't learn necessary steps.Cheers,MC

Share this post


Link to post
Share on other sites

OK, everything is installed. However, nothing has been tested.So, I think that at this step you should add some testing, explain how to configure httpd.conf in order to add a user, create a database for that user, and untar phypmyadmin and check that it easily uses php and apache for accessing the database.

Share this post


Link to post
Share on other sites

The installation procedure above will cause the Apache2 and MariaDB daemons to start, but the PHP module for Apache2 won't be loaded (because the module was installed after the Apache2 server was already started).

 

Restart the Apache2 daemon

sudo service apache2 restart

In the default Apache2 configuration, the root of your web directory is /var/www.

 

If you open your browser and go to localhost, you'll get the "It Works!" page. To test a PHP script, create the file /var/www/test.php as superuser or root.

 

Put the following in the /var/www/test.php file:

<?phpecho 'My version of PHP: ' . phpversion();?>

Load the test page in your browser by going to localhost/test.php.

 

I'll post a tutorial later on how to create a database, read data from the database using PHP, and echo it to a web page.

 

 

Here's how to stop the Apache2 and MariaDB daemons:

 

Stop the Apache2 daemon

sudo service apache2 stop

Stop the MariaDB daemon

sudo service mysql stop

Share this post


Link to post
Share on other sites

They have acquired a lot of content management companies, logistics and transportation, financials, social networks, etc I'm just waiting till they put out something that makes heads turn. Although, probably targetted at enterprises, so it's going to come with a hefty price tag.


I don't think Oracle cares about these small fries. They have no incentive to maintain MySQL because they'd much rather companies use their namesake database management system. MySQL was really unwanted baggage that Oracle got with the purchase of Sun.

Share this post


Link to post
Share on other sites

If you open your browser and go to localhost, you'll get the "It Works!" page. To test a PHP script, create the file /var/www/test.php as superuser or root.

If this is a server, it has to accessed by client machines, so you also have to configure the "listen" instruction in httpd.conf saying which IP address has to be served ("listen"ed to).

Because the main reason for installing a sever is playing with client machines :D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.