Just another idiot with a blog
Currently Browsing: Linux

Configuring PHP Web server on Fedora 11

This is going to be a quick and simple tutorial on how to setup a Fedora 11 Linux Server with PHP, MySQL, Apache and phpmyadmin. Now I’m assuming you already have the OS installed on your machine. Most of you will be using cloud servers, mine is from Linode.com. You will need to have shell access to your server. If you have very little experience with linux I suggest you brush up and learn a little syntax so you aren’t shooting in the dark.

Ok, so lets get started with the actual configuration of the server. At this point I AM ASSUMING you have the operating system installed and its just a bare canvas.

Here we go, hold on kids.

The first step that is needed to taken is open up your terminal, I personally use PuTTY, a free telnet/ssh client. One you are logged in make sure you have full access to the system, whether it be root or sudo.

Now lets install PHP and MySQL. These will be commands you type in the terminal.  We will be installing the apache, mysql and php and configuring them.

  • yum -y install httpd php mysql mysql-server php-mysql

We set chkconfig so that when rebooted the servers will start automatically, and we do this like so.

  • chkconfig httpd on
  • chkconfig mysqld on

Now that Apache and MySQL are starting with the server, we can configure MySQL

  • mysqladmin -u root ‘root_pw_of_your_choice’

Now lets install phpMyAdmin, a mysql database management tool.

  • yum install phpMyAdmin.noarch

Since that has been taken care of let, lets open up the phpmyadmin config.

  • nano /etc/httpd/conf.d/phpMyAdmin.conf

At this point what we need to do is comment out a certain section. Notice that I have a # which denotes comment out

#<Directory /usr/share/phpMyAdmin/>
#   order deny,allow
#   deny from all
#   allow from 127.0.0.1
#</Directory>

Next we are going to jump into the httpd.conf, otherwise known as the Apache Config File

  • nano /etc/httpd/conf/httpd.conf

Once in there you are going to want to change a section

<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>

You will want to set it to AllowOverride All, by default it should be set to none, but we dont want that.

Now at the end of the file add these to make your IP address directly or URL go directly to phpMyAdmin unless you set a virtualhost otherwise.  You need to put all of this at the bottom of your httpd.conf file

<VirtualHost your.ip:80>
ServerAdmin youremail@server.com
DocumentRoot /usr/share/phpMyAdmin/

ServerName yourIP
ServerAlias yourIP

ErrorLog logs/home-error_log
CustomLog logs/home-access_log common
</VirtualHost>

Include /etc/httpd/conf/sites-production/*
Include /etc/httpd/conf/sites-development/*

Save and close the conf file and finally create your folders than you included, e.g

  • mkdir /etc/httpd/conf/sites-production
  • mkdir /etc/httpd/conf/sites-development

Now that the config file directories are made, lets make the place holders for the actual website content

  • /var/www/sites-production
  • /var/www/sites-development

That about sums it up for the base server setup on fedora 11 for a linode VPS.  If you want more PHP Packages just run this command and you should have everything you need.

yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php-magpierss php-mapserver php-mbstring php-mcrypt php-mhash php-mssql php-shout php-snmp php-soap php-tidy curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel

If you need any MySQL help for setting up users, I reccomend this site

http://www.databasef1.com/tutorial/mysql-create-user.html

If any help is needed feel free to leave comments and I will respond.  Good luck!

Feeling Generous??

Sign up for a linode VPS, I pay $20 a month and it fucking rocks

My Linode.com Referral Code 2bf9ae77ecd8e759a2b79bf1011e1c3147d93525

-Wes

Copyright ©2010 wessray.com
Protected by Copyscape Unique Content Validation