Asked By
hctgibbs
10 points
N/A
Posted on - 10/31/2011
Hi everyone
I want to install PHP and MySQL but I don’t know how to host my website while using a domain like http://www.mysite.com/ on my computer.
Still, I am wishing to use Linux.
Thanks
Answered By
lee hung
75 points
N/A
#97015
Help with Installation of PHP and MySQL
Hello Gibb,
To use PHP and MySql to host your site, you will need to install a program called xampp or wamp on your computer.
Xampp comes with both PHP and MySQL and therefore when you install it you will just need to start these services by clicking on the xampp icon that will be on your desktop. You will also need to start the Apache web service.
After that type http://localhost in the address bar of you browser and press enter, and then locate PHPmyAdmin in the page that will open.
You can now create and edit databases in MySQL from here.
Regards
Lee Hung
Answered By
mhasan
0 points
N/A
#97016
Help with Installation of PHP and MySQL
HI Hctgibbs
Â
Here I would like to help you out by providing guidance about your question regarding hosting your website on your Linux Computer.
Â
I wish you had a little pre-req knowledge about Linux regarding basic commands.
Â
The first and most important thing when talking about hosting a site on your computer is if you want to browse the site only on your system or you want to make it publicly available.
Â
If you want to make it locally available and don't want to access your site out of your LAN then there is no need to register the domain otherwise if you want to access it publicly then definitely you need to register this domain first.
Â
The better I will recommend to visit www.godaddy.com and register your required domain there say mysite.com.
Â
For your ease, I Â am creating here possible scenarios:
Â
Case 1: (Website need to be accessible only on LAN)
Â
I wish your Linux system is ready, installed and available on the network for the further setup
Â
Now the first thing is to decide which webserver you want to use for serving your PHP code.
Â
The most well known webserver on Linux platform is Apache and the daemon is known as 'httpd'
Â
Â
There are others as well like nginx and lighttpd
Â
The straight and easy way to install Apache on your system is to use yum (in case of Fedora, redhat) or apt-get (in case of Ubuntu or Debian)
Â
yum install httpd
Â
Or
Â
apt-get install apache2
Â
Once the installation is successful you can start the webserver by issuing
Â
service httpd start
Â
You can test the webserver is up and running by issuing following command and you will see the test page.
Â
elinks http://localhost
Â
Similarly you can install PHP and mysql
Â
yum install php
Â
Or
Â
apt-get install php5
Â
apt-get install libapache2-mod-php5
Â
yum install mysql mysql-server
Â
Or
Â
apt-get install mysql-client mysql-server
Â
Â
Â
You can start mysql in different ways like
Â
service mysqld start
Â
Or
Â
/etc/init.d/mysql start
Â
Now load your schema into my SQL DB.
Â
Now place your PHP code in the default document root and point your browser to localhost. If all goes well you can change the default hostname of your machine as follows
Â
hostname www.mysite.com
Â
Or update /etc/hosts file
Â
Case 2: (Website need to be accessible publicly)
Â
In this case your computer must have a public IP address available from your internet link provider.
Â
You can update your hosted DNS with A record having name at www for domain mysite.com
Â
www record should point to the public IP address of your computer.
Â
Remaining procedure will remain same as in case 1
Â
Hope this all helpful for you. For any further questions you can come back to me and I will try to be more helpful.
Â
Hasan Jamal