Get Paid to Participate - up to $1 per post!     Twitter     Facebook     Google+
Hosting Discussion
 

Hosting Discussion > Web Hosting Forums > Hardware and Server Configuration > How To Install Apache with MySQL and PHP on Linux CentOS
forgot password?



Reply


Old
  Post #1 (permalink)   06-19-2011, 09:46 AM
HD Newbie
 
Join Date: Dec 2010
Posts: 47
Send a message via Skype™ to Netshop-Isp

Status: Netshop-Isp is offline
One of the first tasks a server administrator will have to perform to setup a web server is to install apache with mysql and php support (LAMP – Linux Apache Mysql Php).

In this tutorial we will use the hostname server1.example.com with the IP address 192.168.0.1. These settings might differ for you, so you replace them where appropriate.

1. Install MySQL 5

yum install mysql mysql-server


Then we need to create the system startup links for MySQL so that MySQL starts automatically whenever the system boots:

chkconfig –levels 235 mysqld on /etc/init.d/mysqld start

Then run the following commands to setup a password for the root user of mySQL database (otherwise everyone will be able to connect!):

mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword


2. Install Apache 2

yum install httpd

Now run the following command to configure Apache to start at boot time…

chkconfig –levels 235 httpd on

Now start Apache:

/etc/init.d/httpd start

Apache has been successfully installed! Go to http://192.168.0.1 and you should see the Apache2 Welcome page.

3. Install PHP5


yum install php

Now restart Apache:

/etc/init.d/httpd restart


… and you are done!

4. MySQL Support in PHP5

To get MySQL support in PHP, install the php-mysql package. We also recommend to install some other PHP5 modules as you will probably need them for your applications. You can search for available PHP5 modules like this:

yum search php


Choose the ones you need and install them like this:

yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc

Now restart Apache2 again:

/etc/init.d/httpd restart

… and you are done!

Now if you go to http://192.168.0.1/info.php in your browser, scroll down to the modules section again and you should now find lots of new modules there.
__________________
Leading Web Hosting Provider
Data Centers in Cyprus, Malta and United Kingdom
Web: https://www.netshop-isp.com.cy
Email: sales@netshop-isp.com.cy | Skype: netshopisp
 
 


Old
  Post #2 (permalink)   06-22-2011, 06:48 PM
HD Amateur
 
Join Date: May 2010
Location: USA
Posts: 54

Status: Surmounted.NET is offline
Great little write up!
 
 
 


Old
  Post #3 (permalink)   06-22-2011, 11:31 PM
HD Newbie
 
Join Date: Jan 2011
Location: Ashburn VA
Posts: 29

Status: Bitcable is offline
Very useful and minimalist -- I like it! Maybe next you could show an nginx setup?
__________________
Bitcable | Global IT Tech LLC @bitcable
24/7 Support, Live Chat, 99.9% Uptime
Nginx-accelerated brilliance -- How fast is your host?
Now with VPS's! -- KVM, KVM, KVM!
 
 
 


Old
  Post #4 (permalink)   08-09-2011, 07:24 PM
HD Newbie
 
Join Date: Jul 2011
Posts: 37

Status: sam_basshost is offline
I like the write up nice and easy to understand
 
 
 


Old
  Post #5 (permalink)   08-11-2011, 12:59 AM
HD Newbie
 
Join Date: Dec 2010
Posts: 47
Send a message via Skype™ to Netshop-Isp

Status: Netshop-Isp is offline
I'm happy that you find this one useful
__________________
Leading Web Hosting Provider
Data Centers in Cyprus, Malta and United Kingdom
Web: https://www.netshop-isp.com.cy
Email: sales@netshop-isp.com.cy | Skype: netshopisp
 
 
 


Old
  Post #6 (permalink)   08-13-2011, 05:34 PM
Account Disabled
 
Join Date: Jul 2009
Posts: 114

Status: PhotonVPS-Jim is offline
Have you tried Centmin? This is rather light weight and substitutes Apache with Nginx.

http://www.btcentral.org.uk/projects/centmin/
 
 
 


Old
  Post #7 (permalink)   08-16-2011, 02:49 AM
HD Addict
 
Join Date: Nov 2010
Posts: 146

Status: hostloc is offline
the php5 installation is not that simple, you always need to configure something else and you have to get an updated source in order to update to newest version.
__________________
Hosting Reviews | Hosting Coupon
Find the most suitable web hosting for your site
 
 
 


Old
  Post #8 (permalink)   08-16-2011, 08:08 PM
HD Amateur
 
Join Date: Sep 2007
Location: ohio
Posts: 62
Send a message via Yahoo to Edwart

Status: Edwart is offline
May i use this tutorial in my faq for my clients?
 
 
 
Reply

Thread Tools

New Post New Post   Old Post Old Post
Posting Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Sponsored By: