Book Image

AJAX and PHP: Building Modern Web Applications 2nd Edition

By : Audra Hendrix, Bogdan Brinzarea, Cristian Darie
Book Image

AJAX and PHP: Building Modern Web Applications 2nd Edition

By: Audra Hendrix, Bogdan Brinzarea, Cristian Darie

Overview of this book

<p>AJAX enables interactive interfaces that can replace traditional user interfaces. Enhance the user experience of your PHP website using AJAX with this practical and friendly tutorial! This book is the most efficient resource you can get to enter the exciting world of AJAX with PHP. Based on numerous examples and detailed case studies, this AJAX with PHP tutorial will build your foundation knowledge for creating faster, better web applications.<br /><br />Detailed description<br />The best AJAX tutorial for PHP developers has been completely rewritten to be your friendly guide to modern Web 2.0 development techniques! AJAX and PHP: Building Modern Web Applications, 2nd Edition covers every significant aspect of creating and maintaining AJAX and PHP applications.<br /><br />This book will teach you how to use PHP, JavaScript, MySQL and jQuery to build modern, responsive web applications. After building a strong foundation, the book will walk you through numerous real-world case studies covering techniques you’ll be likely to need for your own applications:</p> <ul> <li>Learn how to write unobtrusive, degradable, portable, SEO-friendly AJAX code</li> <li>Understand the object-oriented model of JavaScript and JSON</li> <li>Learn how to use the jQuery JavaScript library by going through two complete case studies</li> <li>Debug your AJAX and PHP code using modern tools</li> <li>Assess the security implications of writing AJAX code and avoid security risks such as cross-site scripting</li> <li>Learn advanced AJAX and PHP patterns and techniques such as predictive fetching, progress indicator, graceful degradation, cross-domain calls, and more</li> <li>Understand the complete client-server mechanism by going through complete, step-by-step case studies, including AJAX Form Validation, and AJAX Online Chat and AJAX Editable DataGrid with jQuery</li> </ul>
Table of Contents (16 chapters)
AJAX and PHP
Credits
About the Authors
About the Reviewer
Preface
Index

Installing XAMPP


XAMPP is a package created by Apache Friends (http://www.apachefriends.org), which includes Apache, PHP, MySQL, and many other goodies. If you don't have these already installed on your machine, the easiest way to have them running is to install XAMPP. XAMPP ships in Linux, Windows, Mac OS X, and Solaris versions.

Tip

Our web-hosting friends at http://nexcess.net are offering special discount prices for the readers of this book. Their servers are also configured to run the examples in this book.

Follow the steps of the exercise in the next section to install XAMPP on your Windows machine. The installation instructions for Linux are presented afterward, in a separate exercise. Mac OS X users can find their version of the software, together with installation instructions, at http://www.apachefriends.org/en/xampp-macosx.html.

For more information about installing XAMPP, you can check out its Installation wiki page at http://www.installationwiki.org/XAMPP.

Installing XAMPP on Windows

Here are the steps that you should follow:

  1. Visit http://www.apachefriends.org/en/xampp-windows.html, and download the XAMPP Lite installer package, which should be an executable file named something like xampplite-win32-version-installer.exe.

    Windows Vista users should take note of the Vista note on the page, which reads:

    Because of missing or insufficient write permissions in C:\Program Files, we recommend to use alternate folder for XAMPP (C:\xampp or C:\meinverzeichnis\xampp).

  2. Execute the installer executable. We recommend that you install XAMPP in the root folder of your drive (this will create a folder named C:\xampplite). In most cases, it's safe to use the default options throughout the setup process.

  3. After the setup finishes, start the XAMPP Control Panel and configure Apache and MySQL to start Apache and MySQL as services (by selecting the checkboxes), then start the services (by pressing the Start buttons), as shown in the following screenshot:

    Tip

    You can't have more than one web server working on port 80 (the default port used for HTTP communication). If you already have a web server on your machine, such as IIS, you should make it use another port, uninstall it, or deactivate it, otherwise, Apache won't work. To make Apache work on another port, you should edit C:\xampp\apache\conf\httpd.conf, locate lines containing Listen 80 and ServerName localhost:80, and replace the value 80 with the port number of your choice (8080 is a typical choice for a second web server).

  4. To test that Apache installed correctly, load http://localhost/ (or http://localhost:8080/ if Apache works on port 8080) using your web browser. An XAMPP welcome screen, like the one in the following screenshot, should load:

  5. To test the phpMyAdmin installation, load http://localhost/phpmyadmin/. The page should look like the following screenshot:

Tip

For more details on installing and using phpMyAdmin, see its documentation at http://www.phpmyadmin.net/home_page/docs.php. Packt Publishing has a separate book for those of you who want to learn more about phpMyAdmin—Mastering phpMyAdmin for Effective MySQL Management (ISBN: 1-904811-03-5). In case you're not a native English speaker, it's good to know that the book is also available in Czech, German, French, and Italian.

Installing XAMPP on Linux

Here are the steps you should follow:

  1. Visit http://www.apachefriends.org/en/xampp-linux.html, and download the XAMPP package, which should be an archive file named something like xampp-linux-X.Y.Z.tar.gz.

  2. Execute the following command from a Linux shell logged as the system administrator root:

    tar xvfz xampp-linux-X.Y.Z.tar.gz -C /opt

    This will extract the downloaded archive file to /opt.

    Tip

    You can't have more web servers working on port 80 (the default port used for HTTP communication). If you already have a web server on your machine, you should make it use another port, uninstall it, or deactivate it. Otherwise, Apache won't work. To make Apache work on another port, you should edit /opt/lampp/etc/httpd.conf, locate the lines containing Listen 80 and ServerName localhost:80, and replace the value 80 with the port number of your choice (usually the 8080 is used).

  3. To start XAMPP, simply call the following command:

    /opt/lampp/lampp start

    To restart XAMPP, replace start in the previous command with restart, and to stop XAMPP, replace it with stop.

  4. To test that Apache installed correctly, load http://localhost/ (or http://localhost:8080/ if Apache works on port 8080) using your web browser. An XAMPP welcome screen, like the one in the previous screenshot, should load.