HOME       >>       Websites and Web Designing

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


Tags: GNU/Linux, GNU (Operating System), Linux (Kernel), Apache2, httpd

loramchugh

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


iGuest

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


yordan

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.


loramchugh

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


loramchugh

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.

yordan

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



VIEW ORIGINAL REGISTER GET FREE HOSTING

Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.