Install Apache and PHP on Fedora

apache

1) Change to root user

su
##OR##
su -c

 2) Check or install updates

yum check-update
##OR##
yum update

  3) Install Apache(httpd) web server

 yum install httpd

 4) install PHP and PHP modules

yum install php php-common
##PHP MODULES##
yum install  php-pecl-apc php-cli php-pear php-pdo php-mysql php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml

 5) Start Apache(httpd) and start Apache(httpd) on boot

systemctl start httpd.service ##will start httpd##
systemctl enable httpd.service ##will enable httpd service on boot##
##OR##
service httpd start
chkconfig –levels 235 httpd on

6) Enable Remote Connection to Apache HTTP Server (httpd) –> Open Web server Port (80) on Iptables Firewall

6(a) Edit /etc/sysconfig/iptables : 
vi /etc/sysconfig/iptables
6(b) Add following INPUT rule:
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
6(c)  Restart Iptables Firewall:
systemctl restart iptables.service
##OR##
service iptables restart

7) Test Apache and PHP

7(a) Test Apache:
To test Apache web server open web browser and type “http://localhost/”
you will see a Fedora Test page For Apache HTTPD Server
Apache_testpage_fc17
7(b) Test PHP:
Create test PHP page to check that Apache, PHP and PHP modules are working by adding following content to/var/www/html/test.php file.
<?php
phpinfo();
?>
Now open the browser and type “http://localhost/test.php&#8221;
php_test_page_fc17

Thanks for reading. If you have any suggestions or query, please feel free to comment.

No comments:

Post a Comment