PHP and MySQL Resources

Tags:

PHP and MySQL

PHP is an open-source server-side scripting language that runs on Windows, Mac, and Linux. It allows your website to perform calculations and manipulate data. You should know HTML before starting to learn PHP. There are other ways to manipulate data on the server such as ASP, Python, Perl, and Ruby, but PHP is a good place to start because it is free and not too difficult. ASP doesn't work on Windows XP Home, while PHP does. PHP, Python, Perl and Ruby will run on just about any system, including Windows, Macintosh, Linux, and BSD.

MySQL is an open-source database that works well with PHP. It is free for non-commercial use. It can be used on any size site. Yahoo, Craig's List, and NASA are some organizations that use MySQL on their websites.

To get PHP and MySQL on your Windows computer for learning purposes, see the Apache2Triad tutorial below. If you are using Linux, you probably already have Apache and PHP on your computer.

PHP and MySQL Links

W3schools.com -- Intro to PHP.
PHP.net -- Home of PHP
PHP MySQL Tutorial -- A great tutorial for learning how to access a database with PHP
PHP tutorials -- from Zend.org
Codewalkers -- tutorials for PHP and MySQL.
Apache2Triad -- automatically installs and configures PHP 5, MySQL, Apache 2, Perl, Python, phpMyAdmin and much more on your Windows computer.
MySQL website -- Homepage of MySQL.
Devshed -- Open source web development tutorials, including PHP, MySQL and more.
PHP 'include' Statements - - How to safely use PHP 'include' statements.
URL Rewriting -- An excellent tutorial on how to make your URLs change from dynamic ones (e.g. www.your-website.com/index.php?p=cars) to static-looking ones (e.g., www.your-website.com/cars.htm). This is helpful for search engine rankings. I believe that it is better to rewrite your URLs before you put your site online. Otherwise the search engines may spider two copies of each page, each with different URLs.


How To Install Apache2Triad

To get PHP, MySQL, Apache, Perl, and Python on your computer with just a few clicks, go to apache2triad.net and follow the link to download Apache2Triad. Once it is downloaded, double-click on the file and follow the installation instructions. I believe you will be asked to set a username and password.

If you are just installing Apache/PHP/MySQL so that you can learn how to make web sites, log into the Apache2Triad control panel by entering http://localhost/apache2triadcp into the browser. You will be asked for your username and password. This is where you can access the Apache2Triad settings. Scroll down to the bottom of that page to this section:

Bottom of control panel screen

Uncheck all the boxes. That will prevent unwanted services from starting when you boot the computer. If you want any of them to autostart, like Apache and MySQL, then you can leave them checked. I prefer to manaully start the services when I need them with the Apache Monitor and the WinmysqlAdmin tool. Both tools are found in the start menu at the top of the "All Programs" menu. More information can be found at the Apache2Triad docs page.

How To Test PHP Scripts With Apache2Triad

You can write your PHP scripts with any text editor. See the links to tutorials at the top of this page for more information on how to write the scripts. Save them in the following folder: C:/apache2triad/htdocs/. You can make your own folders to organize your web sites within that directory.

To run the scripts, open up your browser (I recommend Firefox) and type in the following address: http://localhost. You will be looking at your htdocs directory in the browser. Navigate to the path of your script and it will run.

Running Apache and IIS with Apache2Triad

If you want to run both Apache and IIS on the same computer, this is one way to configure it.

Navigate to the following folder: C:\apache2triad\conf.

Make a backup copy of the file called httpd.conf and name the copy httpd.conf.BAK. Open the original httpd.conf file in a text editor (either Notepad, or something like jEdit). Look for a section that looks like the image below. The fastest way to find this section is to press CTRL-F and enter "Listen 80" into the find box--or you can just scroll down until you find it. Look at the last line in the following image that says "Listen 80":

Original httpd.conf file settings

Change the last line from "Listen 80" to "Listen 82" as shown by the red arrow below.

Modified httpd.conf file settings

Save the file. Now Apache is set to listen on port 82, and IIS is listening on its default port 80. IIS will respond to http://localhost and Apache will now respond to http://localhost:82.

No votes yet
Syndicate content