May 2005
Mr. Know-It-All has the answers to even the really tough questions.
Question:
Hi!
It's time for me to do a web application and I need to install MySQL and PHP
on my Apache2 server. Is there anything I need to watch out for?
Answer:
Well, there's always something.
All of the following assumes Apache2 v2.0.49,
PHP v4.3.10 and
MySQL v4.1.7.
The examples that follow assume you are booting from volume C: and that
the applications and data are on volume D:.
Finding the code
First, use the
OS/2 Power
link to find the WarpIn install packages for v4.1.7.
If you use the old
DNS alias
link, you will be taken to the page for the older v4.0.18.
As of the date of this article, this page not been updated to point to v4.1.7.
Installing the packages
The WarpIn packages install without errors for most users,
but usually do not result in a ready to run MySQL setup.
The install places code>LIBC06B4.DLL in mysql41\dll
and does not update LIBPATH .
Mr. KIA recommends you move LIBC06B4.DLL to mysql41\bin .
If the DLL can not be found via a LIBPATH search,
the server will not start.
The build also requires LIBC06B2.DLL
which is not included in the WarpIn packages.
If you do not already have a copy, get it from
LIBC06B2
Mr. KIA recommends you copy the DLL to mysql41\bin .
If the DLL can not be found via a LIBPATH search,
the MySQL client will not start.
Network drivers
MySQL requires features provided by the AFOS2.SYS driver.
Make sure CONFIG.SYS contains DEVICE=AFOS2.SYS .
If you do not load this driver,
the MySQL server will not be able to set up the sockets it uses.
My.cnf is optional
The manual is not entirely clear about this.
My.cnf is optional unless you want to change the default settings.
The default settings are OK for getting started.
If, or when, your application needs to be tuned,
you can create my.cnf with the appropriate settings.
For large databases, it is often a good idea to the keep the database store separate
from the MySQL applications.
This requires specific my.cnf settings.
When tuning an installation, it is often helpful to turn off the storage engines you
are not using.
This is best done with my.cnf settings.
Mysql.inf is out of date
The INF version of the MySQL manual is pretty far out of date.
Mr. KIA recommends you bookmark the
MySQL Online Manual
.
It is well organized and fully searchable.
Since you are also going to be doing PHP coding, you should bookmark the
PHP Language Reference Manual
.
TMP needs forward slashes
This is one of those places where MySQL shows its unix heritage.
If you have TMP defined as set TMP=d:\tmp
some work files might end up in the root of the volume.
This is usually just messy unless you neglect to clean up the leftovers.
Mr. KIA recommends that you redefine TMP with
set TMP=d:/tmp
when starting up the MySQL server or client.
This can be done with a script or by editing the MySQL program objects.
MySQL client does not do command line editing
There is a build problem in the v4.1.7 distribution and readline support
is not compiled into the MySQL client.
If you want to have command line history and editing available, download the
v4.0.18 WarpIn package
.
Use WarpIn's wic.exe to extract the package contents to a work directory.
Copy
libc05.dll
mysql.exe
mysql40.dll
to a convenient directory and create a program object for mysql.exe .
Mr. KIA chose mysql41\bin4.0.18 .
PHP extensions not enabled
The PHP v4.3.10 documentation claims the MySQL PHP extensions are enabled by default.
This is not true.
Add
extension=mysql.dll
to the
[PHP] section of php.ini .
PHP DLL locations
New users often get the PHP executable locations wrong.
Put
php4.dll where it can be found with a LIBPATH search.
Mr. KIA recommends d:\Apps\apache2\bin .
This assumes your Apache2 startup script contains
set BEGINLIBPATH=d:\Apps\apache2\bin
Put the standalone version of php4.exe in the
apache2\bin directory.
Put the CGI version of php4.exe in the
apache2\cgi-bin directory.
Put modphp4.dll in the apache2\modules directory.
The modules directory does not need to be in LIBPATH .
Apache2 takes care of this internally.
PHP configuration
You must enable PHP in httpd.conf with:
LoadModule php4_module modules/modphp4.dll
and
AddType application/x-httpd-php .php
You must create a php.ini file in your ETC directory.
The file can be empty, but it must exist or the PHP module will not work.
The default PHP settings are usually fine for getting started.
You should adjust the security settings before releasing your app for production use.
Troubleshooting
The Internet is full of tips and techniques
for effective troubleshooting of Apache/PHP/MySQL setups.
Mr. KIA will add just a couple here.
Mr. KIA uses the following program object setting to start the MySQL server:
Program: *
Parameters: /c set TMP=d:/tmp & MYSQLD.EXE --console & if errorlevel 1 pause
Work directory: d:\Apps\mysql41\bin
Mr. KIA recommends setting
display_errors = On
in php.ini so that PHP error messages display in the browser window.
Curious or in doubt, you can ask
Mr. Know-It-All
OS/2 is his specialty and sharing solutions is his passion
Mr. Know-It-All lives in Southern California.
The Southern California OS/2 User Group
P.O. Box 26904
Santa Ana, CA 92799-6904, USA
Copyright 2005 the Southern California OS/2 User Group. ALL RIGHTS
RESERVED.
SCOUG, Warp Expo West, and Warpfest are trademarks of the Southern California OS/2 User Group.
OS/2, Workplace Shell, and IBM are registered trademarks of International
Business Machines Corporation.
All other trademarks remain the property of their respective owners.
|