PHPTriad Help
Welcome to PHPTriad 2.2. PHPTriad installs Apache, MySQL and PHP on Windows machines. It's primarily intended as a development and staging environment for building PHP applications. While you can use it to serve a real site, it is not recommended for public web sites. Security on a live web site can be complicated and therefore I recommend only using PHPTriad within a firewalled environment or for development purposes.
Because PHP is cross-platform, PHPTriad can be used (and I highly recommend it) to develop sites that will be deployed on Linux/BSD/other Unix machines and web hosts.
Getting Started
Apache and MySQL run as server daemons. They stay in the background waiting for requests. As a result, they need to be running in order for the whole server setup to work. We've provided the PHPTriad Control Panel to assist you in starting and stopping server daemons. You can launch it through the Start menu shortcut provided by the installer. The servers can also be started from the Start menu shortcuts for each application as well.
The most basic way to get started is this:
- Launch the PHPTriad Control Panel from the start menu.
- Click "Install Apache Service".
- Click "Start Apache".
- Click "Start MySQL". Choose the appropriate link based on your version of Windows.
- Click "Open site w/default browser".
- Edit your site by changing/replacing the files in c:/apache/htdocs. You can get there easily by clicking "Edit Site" in the PHPTriad Control Panel.
- Visit your site in the future at http://localhost.
Apache
- Apache is configured to respond to all requests on port 80.
- The configuration file to change Apache's settings is located at c:/apache/conf/httpd.conf. In that same directory are alternative httpd.conf files to switch PHP's mode to the module instead of CGI. Simply rename the appropriate file to httpd.conf. Be sure to restart Apache.
- Any changes made to Apache will only be reflected after a restart.
MySQL
- MySQL ships with a single "root" user that has no password. It is recommended that you both set a password for this user as well as creating a new user to use for your scripts. To add a password for root:
C:\apache\mysql\bin\mysql -u root mysql
mysql> SET PASSWORD FOR root@localhost=PASSWORD('new_password');
- To add users, read the documentation at http://www.mysql.com/documentation/mysql/bychapter/manual_toc.html#Adding_users
PHP
- PHP 4.1.1 is installed.
- PHP is configured in the CGI mode. If your script depends on the module integration with Apache, see the Apache section to change your configuration.
- NONE of the extensions are enabled, though all of the freely available ones packaged with the binary distributions of PHP are included. In php.ini (linked from the PHPTriad Control Panel), the available extensions are listed near the end. To enable a given extension, you need to remove the semicolon in front of its entry.
Frequent Problems
Several problems pop up frequently. If you're not used to server-side development, you may run into these issues.
- Be sure to always access your site through a real url like http://localhost/directory/script.php. Many beginning web developers are used to opening HTML files directly through the browser's File menu. That works with static content, but PHP requires the web server environment to properly parse files.
- If you are using a cable or DSL connection, your ISP may be blocking port 80, which is the default port on the web. That means that anyone outside your local network will be unable to access your site. See the article on getting around this at PHPGeek.com
- While PHP is cross-platform, scripts occasionally take advantage of Operating System specific features. For instance any script that uses the crypt() function will NOT work on Windows. Solutions to these problems are going to be specific to the script. First check with the resources for the script for Windows compatibility.
- Windows doesn't have a mail server by default. Scripts that use mail() will not work unless you have a mail server at your disposal. I recommend Hermes.
- It is normal for the console interface to Apache to stay open. Use the service links (yes, they work in Windows 98) in the PHPTriad Control Panel if you want to have everything run in the background.
- It is normal for the MySQL daemon to flash a DOS windows and go away. If you do a CTRL-ALT-DEL you should see a mysqld* entry if it is running.