Install and Test PHP on Linux system
Q. How can I install and test PHP on Linux? How do I make sure it is working on my Linux system? I am using Red Hat Fedora Core Linux.
A. PHP (PHP Hypertext Preprocessor) is an open-source, programming language. Originally designed as a high level scripting language for producing dynamic Web pages, PHP is used mainly in server-side application software.
Task: Install PHP
If you are using Fedora Core or Cent Os Linux, type the following command:
# yum install php
If you are using Debian Linux, type the following command:
# apt-get install php5
Now restart Web Server:
# /etc/init.d/httpd restart
Task: Test php
Go to /var/www/html/ directory:
# cd /var/www/html/
Create a php file – phptest.php
# vi phptest.php
Append following lines:
<?php phpinfo(); ?>
Save and close the file.
Open a web browser and type the url : http://yourdomain.com/phptest.php or http://localhost/phptest.php or http://server-ip-address/phptest.php.
See sample output here
E-mail this to a friend
Printable version
Related Other Helpful FAQs:
- How To Open .TBZ ( tar.bz2 ) File Under Linux / UNIX
- Howto see output of C program in Linux or UNIX
- How do I test php installation with a phpinfo page?
- Explain Usage Of The Linux Left Bracket /usr/bin/[ Command
- Linux basic memory test for errors
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!



Recent Comments
Today ~ 7 Comments
Today ~ 2 Comments
Today ~ 3 Comments
Today ~ 3 Comments
Yesterday ~ 70 Comments