Wednesday, July 16, 2008

PHP Tutorial #2 - Installation

Previous*

Installation

There are many methods and installation packages available on the internet.
What I will be showing here are the one we used.

For Windows developer:
http://www.wampserver.com/en/

Download the installation and install.
As of this tutorial, it was
WampServer 2.0c
Includes :
- Apache 2.2.8
- MySQL 5.0.51b
- PHP 5.2.6

For Linux developer:
For debian / knoppix /ubuntu based distribution:
Run this command in terminal / console:
sudo apt-get install apache2 php5 php5-cli php5-gd php5-mysql mysql-client mysql-server
The installation of MySQL will prompt you for root password.
This password will be mysql root user password, not your operating system root user password.
Therefor, you may enter a different password for security purpose.

Your root folder to localhost will be /var/www/

For CentOS / Redhat:
Run this command in terminal / console:
yum install httpd php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
Note*: this section need further information...


Finalising:
Once Installed, you may test your installation by opening this url in your browser:
http://localhost/

To Test PHP,
Code this in notepad(windows) or gedit/mousepad (linux), and save it as test.php in the root of web folder (example: /var/www/test.php)

<?php
phpinfo();
?>
Next, test it on your browser as http://localhost/test.php
You shall see a page that look like this:




Misc. Info:
Important files involving web:
/etc/hosts - management of domain to ip
/etc/apache2/sites-available/default (ubuntu / debian based) - virtual host control or other apache configuration
/etc/resolv.conf - dns server setting

Next*

Further References:

Disclaimer:
Logos and photos used in this tutorial are copyright of their respective owner. The content published above is solely for education purpose. Feel free to close this website if you are not happy here.. :)

No comments: