x86, a hack on a hack of a hackalpha, the compaqed wayppc, the fruity waymips, the graphical waym68k, the NeXT waysparc, the reliable way
quote:Brief Guide to PHP/MySQLInstallation andConfigurationWHEN INSTALLING MYSQL AND PHP, you are faced with all kinds of options. Thevariety of operating systems and installation options creates more permutationsthan could possibly be handled in this book. Luckily, installation procedures forboth packages are documented well in each package’s respective documentation.In this appendix we will cover the basic installation and configuration of MySQLand PHP on Windows 98 and Unix systems. I’m assuming that you will be usingthe Apache Web server on all platforms. For the Unix installation, this book willdocument only the method of compiling the source code. If you wish to use RPMsfor your installation, you should consult the online manuals.Windows 98 InstallationStart by copying the MySQL binaries from the CD-ROM accompanying this book orthe mysql.com site to your local drive. Do the same for Apache and PHP (theappropriate download sites here are http://www.apache.org/dist and http://www.php.net/download). The names of the files will be something like the following(they may be slightly different, depending on the version you are using): mysql-3.23.22-beta-win.zip apache_1_3_9_win32.exe php-4.0.1pl2-Win32.zipStart by unzipping the mysql file and php files with your favorite unzip tool. (If youdon’t have one, we recommend Winzip, at http://www.winzip.com/.) Unzip theminto a directory you find convenient. We prefer using a separate directory for each.Start with MySQL. In the directory where you unzipped the file, you will have afile named setup.exe. Execute that file. Choose a directory (e.g. d:\mysqlinstall)where you want it installed, and then in the next screen select a Typical installation.(You may wish to examine the custom options, but with the Windows install thereare very few real options.)At this point your MySQL installation is complete. To test it, go to the DOSprompt and move to the directory you specified for your MySQL installation. Thenmove to the subcategory named \bin. If you then type mysqld, the mysql daemonshould start. To test if your daemon is working, start up the mysql command-lineclient by typing mysql. If the monitor starts up and looks like Figure B-1, MySQL isworking properly.Next, you should install Apache.This requires little more than double-clicking on the executable you copied fromthe CD or the apache.org site. The installation is pretty easy: all you really needto do is select a directory where you would like Apache to be installed. When it’scompleted, an Apache Group item will be added to the Start menu.Note: Don’t start up Apache just yet. A little more configuration informationwill follow.Now on to PHP. You should have a folder into which you unzipped all the PHPfiles. In that folder copy MSVCRT.DLL and PHP4TS.DLL to c:\windows\system. Thenrename php.ini-dist to php.ini and keep it in the same directory were you have thephp.exe file.All you need to do at this point is make sure that Apache is aware of PHP andthat PHP is aware of MySQL.First go to the directory where you installed Apache, find the httpd.conf file withinthe \conf directory, and open it in a text editor. Add these three lines to the file:ScriptAlias /php4/ “d:/php4/”AddType application/x-httpd-php4 .phpAction application/x-httpd-php4 “/php4/php.exe”Note that we indicated the d: drive because that’s how we set up our own system.The c: drive will work just as well.The first line indicates the path where PHP resides. The second tells Apache whatfile extensions must be parsed as PHP, and the third gives the path to the phpexecutable file. Note using this type of installation, PHP will run as an executable,not an Apache server module.If you would like other file extensions to by parsed by PHP, simply add anotherAddType line to the conf file; for example:AddType application/x-httpd-php4 .phtmlThere are a couple of other alterations you may have to make to your httpd.conffile. If the server refuses to start, you may need to add something to the ServerName directive. If you are using TCP/IP in your local area network, you may needto add the IP address of your machine, for instance:ServerName 192.168.1.2Or if your machine is not networked, you may want to user the followingServerNameServerName 127.0.0.1If you also have Personal Web Server running on your machine, you may wishto change the port on which Apache runs. By default, Web servers listen on Port 80,but you can change that by altering the Port line in the httpd.conf to somethingelse—perhaps 8080.And that should do it. Start Apache through the Start Menu. Add a file to your\htdocs folder that contains the phpinfo() function. When you call that functionyou should see that everything is working properly, and that there is an entry forMySQL. Figure B-2 shows the results of phpinfo().Note that you don’t need to make any alterations in the php.ini file to make PHPwork with MySQL. MySQL support is, in fact, built into PHP for Windows.Caution: If you uncomment the directive extension=php_mysql.dll, you will have allkinds of problems getting a PHP page to load.These are the basics you need to get going with PHP and MySQL on Windows.Note that you can also install PHP as an ISAPI filter for Internet Information Server(IIS) and PWS. The instructions for doing so are included in the readme.txt fileincluded in the PHP zip file. As of this writing, running PHP as an IIS filter is notrecommended in a production environment.