Saturday, January 16, 2010

Installing and Configuring Apache, PHP, MySQL on Fedora Core

  • Install Apache (httpd), PHP, MySQL (server and client)

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

  • Configure the new services to start automatically

    # /sbin/chkconfig httpd on 
    # /sbin/chkconfig --add mysqld
    [not required with FC4 and above] 
    # /sbin/chkconfig mysqld on 
    # /sbin/service httpd start 
    # /sbin/service mysqld start

    If everything went okay attempting to open this url:
         http://localhost
    or http://127.0.0.1 will forward to a page like one displayed in image below. Otherwise it will give an error.


    Click image to enlarge

  • By default the document directory is /var/www/html. You can change it modifying /etc/httpd/conf/httpd.conf Modify the lines and set like this:

    DocumentRoot "/home/AR/web"

    And another line

    <Directory "/home/AR/web">


    Changing directory like this may not allow apache to read files or execute scripts. Hence this error message "Forbidded, you don't have permission to access / on this server" can be produced. To get rid of this change the directory attributes to executable.


    # chmod a+x /home 
    # chmod a+x /home/AR 
    # chmod a+x /home/AR/web

    which means that you are giving permission of execution to apache for the entire directory chain. This actually solves the problem. If still the problem persists then apply this command too.

    # chown -R apache:apache /home/AR/web

    Change "/home/AR/web" with your www directory.

  • Add mysqld as startup service

    # /sbin/chkconfig mysqld on 
    # /sbin/service mysqld start

  • Change the mysqladmin password for security reason.

    # mysqladmin -u root password new-password

Notice # means root user prevelige.

No comments:

Post a Comment