Setup a PHP Development Environment

1. Install 7-Zip

2. Install Apache

Apache is the web server that will server the PHP files. After installation, in your browser, go to http://localhost and you will see a page saying that your Apache installation was successful.

3. Install PHP

We will now download and install PHP 5 and then make changes to both the Apache and PHP configuration files so that Apache can serve PHP files. Unzip the file you downloaded. In the directory where the PHP files were unzipped, select all files with CTRL-A and then press CTRL-X . Then create a directory called c:\php and type CTRL-V to move all the files there. Now move (don't just copy) the file c:\php\php5ts.dll to c:\windows\php5ts.dll. Create a directory called c:\webs. Rename the file c:\php\php.ini-dist to c:\php\php.ini.

In the file that you just renamed ( c:\php\php.ini ), make the following changes to the values doc_root and extension_dir, note that you should use backward slashes.

doc_root = "c:\webs"

extension_dir = "c:\php\ext"


Now open Apache's httpd.conf file at C:\Program Files\Apache Group\Apache2\conf\httpd.conf and change the DocumentRoot entry to: DocumentRoot "C:/webs" , note that you should use forward slashes.

DocumentRoot "C:/webs"

In the same httpd.conf file, change the Directory entry to: "C:/webs" , note that you should use forward slashes.

<Directory "C:/webs">

Again in the same httpd.conf file, search for the phrase "media types" and add the following text after the two AddType lines:.

ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php .php5
Action application/x-httpd-php "/php/php-cgi.exe"
SetEnv PHPRC "C:/php"

And lastly in the httpd.conf file, change the DirectoryIndex entry to: index.htm index.html index.php.

We now need to restart Apache so the above changes take effect, so in your taskbar, double-click on your Apache icon.

Test your Apache/PHP installation by creating a file called C:\webs\test\index.php with the following content, and then in your browser go to http://localhost/test.

4. Install MySQL - database

after installation of mysql, In the file c:\php\php.ini remove the preceding semi-colons from php_mysql.dll, php_mysqli.dll and php_pdo_mysql.dll, and php_mbstring.dll

Restart Apache by double-clicking on your Apache icon.

Test your Apache/PHP/MySQL installation by creating a file called C:\webs\test\testMysql.php with the following content, and then in your browser go to http://localhost/test/testMysql.php. If you see no errors and a list of categories is displayed in your browser, then your Apache/PHP/MySQL installation was successful.

<?php
$connection = mysql_connect("localhost", "root", "admin");
$database = mysql_select_db("mysql");
$result = mysql_query("SELECT name FROM help_category");

while($row = mysql_fetch_array($result, MYSQL_NUM)) {
echo $row[0] . '
';
}
mysql_close();
?>

5. Install phpMyAdmin

Unzip the file that you downloaded. Press CTRL-A to select all the files that you unzipped, and then press CTRL-X to indicate that you want to move them. Create a directory called c:\webs\phpmyadmin and press CTRL-V to move all the phpMyAdmin files to this directory.

Create a file called C:\webs\phpmyadmin\config.inc.php with the following content.

<?php
/* Servers configuration */
$i = 0;
/* Server localhost (config:root) [1] */
$i++;
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'admin';
?>

In your browser, goto http://localhost/phpmyadmin and you will see the phpmyadmin start screen.

6. Install Java

To run Eclipse we first need Java so we will download and install it now. Goto developers.sun.com/downloads. Click on the Java SE (JDK) 6 link. Click on the Download button for JDK 6u1. Click Accept. Click on Windows Offline Installation, Multi-language. Click OK to save it to disk. Double click on file that was downloaded. Accept agreement. Click Next and it will install for about 8 minutes. Unclick the Show the readme file checkbox and click Finish .

7. Install Eclipse

Eclipse is a professional editor normally used for Java. We will install it in this step and then install the PHPEclipse plugin so we can use it with PHP.

Goto www.eclipse.org/downloads and click Eclipse Classic. Click "Save to Disk" and click on OK . Unzip the Eclipse file that you downloaded. Type in c:\ and click OK (this will create a directory called c:\eclipse and unpack everything there. Double-click on the file c:\eclipse\eclipse.exe. Set the workspace to C:\webs , click the checkbox, then click OK . Click on the workbench icon. Close Eclipse by clicking on the X. Click the checkbox and OK .

8. Install PHPEclipse

We will now install an add-on to Eclipse which allows you to develop in PHP. Goto sourceforge.net/projects/phpeclipse and click on the Download PHPEclipse button. Click on the download link for the latest release. Click on the first link to download the PHPEclipse zip file. Unzip the downloaded PHPEclipse zip file. Copy the sub-directory under features to c:\eclipse\features. Copy all the sub-directories under plugins to c:\eclipse\plugins. Click the eclipse.exe file again to start it. Change from Java to PHP perspective by clicking on the perspective icon and then on Other.... Choose PHP and then click OK .

9. Install Subversion

Subversion allows you keep a tightly controlled repository of your files of all your changes, a good idea if you work by yourself and necessary if you work in a team.

Goto downloads.open.collab.net/collabnet-subversion.html and click on the Server and Client for Windows Server 2003 link. Double-click on the .exe file you downloaded. Check the svnserve box and click next. We will be accessing our repository via the file system so we don't need the Apache module. Check the Windows Service checkbox and click Next . Click Install . Wait about 20 seconds for it to install.

10. Install TortoiseSVN

TortoiseSVN is a tool which enables you to check files in and out of the Subversion repository with the Windows Explorer.


Goto www.tortoisesvn.net/downloads and click on the .msi link. Double-click on the .msi file you downloaded. Click the I Accept... button and then click Next . Click on Next . Click Install . Unclick Show Changelog and click Finish . Click Yes to restart your system.

11. Install Tortoise Plug-in

The tortoise plug-in allows you to use Tortoise from inside Eclipse.

Goto www.tabaquismo.freehosting.net/ignacio/eclipse/tortoise-svn/subversion.html and click on the Version 1.0.9 link.

Unzip the .zip file that you downloaded. Move the directory that you just unzipped to C:\eclipse\plugins.



9. Install Subversion











10. Install TortoiseSVN











11. Install Tortoise Plug-in




No comments: