Setting Up Your Server


Because this chapter is written under the assumption that you have a beginner-level understanding of PHP scripting, it may be safe to also assume that you have a server environment to develop on. But because it's never safe to make such assumption, we have provided the necessary information to create a server environment in which you can duplicate the examples in this chapter.

The server setup that we are using for the examples in this chapter runs on a Microsoft Windows server. The environment works the same on other servers (Unix, for example), but you will need to download the appropriate files and follow the instruction for the particular server you are working with. To duplicate the examples in this chapter, you will need a server environment with three components:

  • Apache Server

  • PHP

  • MYSQL Database

If you are not familiar with any or all of these components, it may seem like a daunting task to set it all up yourself. Don't fear. It is much easier than you think and there is a world of support out there to help you understand the technology behind it all. The best thing to do is to find a friend or colleague who is familiar with setting up the above-mentioned environment, and have them help you. Each component's website is also jammed packed with tutorials, and the best thing to do is just follow the readme.txt (or install.txt, or setup.txt) files that come with each component's installation files.

NOTE

We almost forgot to tell you the best part about APACHE/PHP/MYSQL developmentit's free! That's right, all three of the components needed are open-source projects with years of development and support. Thought that you might like that!


Installing Apache Server

The Apache server is the "environment" that PHP and MYSQL run in. The Apache server can be downloaded from http://httpd.apache.org/download.cgi. The current version at the time of this writing is 2.0, but we will be using 1.3 because it has been in use for some time and will be the version most hosting companies are currently running on their servers (2.0 also does not offer us any features needed over 1.3; the choice is yours).

The Windows download is a self-extracting installation file. Follow the instructions and refer to the documentation at http://httpd.apache.org/docs/install.html if needed.

Installing PHP

PHP can be downloaded from http://www.php.net/downloads.php. The current version at the time of this writing is 5.0, but we require that you use 4.3 because it has been in use for some time and will be the version most hosting companies are currently running on their servers. PHP 5.0 is not just an upgrade, but a reconstruction of PHP and will not be widely supported for some time. (Hosting companies are starting to offer special servers with PHP 5.0 support, but at the time of this writing support for and development with PHP 5.0 is very limited).

After you download and extract the files, open the install.txt for installation instruction. The installation and configuration for PHP is mostly manual, compared to APACHE being a program installation, but the instructions are simple enough and should be easy to follow.

Installing MySQL

MYSQL is the database that is used mostly when you're working with PHP. MySQL can be downloaded from http://dev.mysql.com/downloads/index.html. The current recommended version at the time of this writing is 4.1; 5.0 is currently in development, but we recommend sticking with 4.1 because it has been in use for some time and will be the version most hosting companies are currently running on their servers.

The Windows download is a self-extracting installation file. Follow the instructions and refer to the documentation at http://dev.mysql.com/doc/mysql/en/windows-installation.html if needed.

Having MySQL installed and working with MySQL are two different things. You can work with MySQL through the command prompt (Windows) or the console (Unix), but we prefer to use a web-based alternative that is much more user friendly, PhpMyAdmin. PhpMyAdmin can be downloaded from http://www.phpmyadmin.net and is very easy to set up. After you download the appropriate files and extract them, open up Documentation.txt (on Windows you will need to open this up in WordPad instead of Notepad because of some rich-text formatting) to find the installation instruction.

NOTE

We recommend that you install each of these components yourself, simply because the education you gain will help you in the future, as well as make you more comfortable with setting up server environments. As mentioned before, it is not as daunting a task as it may seem, and the World Wide Web is chock full of help. Fear not!


Now That It's All Installed

After you have your server set up, you'll want to make sure it works properly.

1.

Create a new PHP document, save it as test.php, and place the following script inside:

 <?php echo "Your server is running as of " . date("l dS of F Y h:i:s A"); ?> 

2.

Put test.php in your server's root directory and then view it through your browser (the default address for a local server is http://localhost/). If you did this correctly, your browser should display something like the following:

 Your server is running as of Wednesday 13th of April 2005 03:07:34 PM 

Learning More About PHP

You may already have a pretty good understanding of working with PHP, but the language has as many functions as the day is long. If you want to learn more about PHP scripting, we recommend that you go straight to the source at http://www.php.net.

PHP is a very powerful language and the more you work with PHP and Flash, the more you will want to do with PHP. Whenever working with PHP I always have php.net open in a browser window to do quick searches. You would be amazed how many times you will learn something new that makes working with PHP easier.




Macromedia Flash Professional 8 Unleashed
Macromedia Flash Professional 8 Unleashed
ISBN: 0672327619
EAN: 2147483647
Year: 2005
Pages: 319

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net