![]() | ![]() |
|
Sybase-PHP-Apache mini-HOWTOTyson Lloyd Thwaitestyson.lloydthwaites@ite.com.au
1. Copyright and LicenseThis document is copyright 2001 by Tyson Lloyd Thwaites, and is released under the terms of the GNU Free Documentation License, which is hereby incorporated by reference. Send feedback to tyson.lloydthwaites@ite.com.au. 2. Install LinuxThis howto assumes you have already installed a working Linux system. This howto is based on a Redhat 6.2 system. I would appreciate any feedback on setting this up on other distros. The first thing you will have to do is uninstall the apache and mod_php rpms. Try the following:
That should get rid of them. Just to be sure, run this:
and check that there is nothing to do with Apache or PHP left on you system. 3. Install SybaseDownload the Sybase-ASE files from linux.sybase.com. Sybase-ASE 11.0.3.3 is free for production. This howto refers to that version. First, install the Sybase RPMS as root:
For information on how to configure Sybase, read the instructions in the file /opt/sybase/doc/howto/howto-ase-quickstart.html. This document is very good, so we shouldn't need any more information here.
4. Configure EnvironmentAfter installing Sybase, you need to setup the Linux environment in order to allow clients to connect to the dataserver. The first thing we need to do is to set certain environment variables in /etc/profile. Open /etc/profile as super user and insert the following lines:
Next you need to change to permissions of the Sybase directory. This fixes some problems where PHP is unable to connect to the Sybase server. Run the following command as super user:
To test whether your Sybase environment works, type the following:
You should see a list of databases. To test whether you can use the sample datebase, now type:
If you a list, you have sucessfully set up Sybase.
You may also want to add sybase to the list of services to run at boot time. To do this execute the following commands:
Now Sybase will start whenever you boot into runlevel 3.
4.1. Preconfigure ApacheDownload and unpack the latest Apache distribution. In the Apache directory issue the following command:
I think the 'prefix' value specifies where you want to store your html files; I just set it to the same as the apache install directory, where Apache will put its files when you run 'make install'. 5. Install PHPDownload the latest PHP distribution and unpack it. Change to the php directory and run the configure script. You need to pass certains options to the script. To enable PHP access Sybase, you need --with-sybase-ct. You will also need to specify the web server interface to use; in our case, this is Apache, so we use --with-apache To build a CGI version of PHP, (which is also very useful as a shell scripting tool), just leave out the --with-apache. Here is a complete configure script with the above two options, as well as a number of other options that are useful.
You will need to change to apache path to wherever you unpacked your apache distribution. If the configure scripts completes successfully, you can then proceed:
PHP should compile without any hitches. After it has installed, you need to install the php.ini file:
Now we need to change a few things in /usr/local/lib/php.ini. Set the following parameters to the ones specified below:
I also like to set the following:
You have now completed the PHP installation. 6. Install ApacheNow cd back into the apache unpack directory. Issue the following commmands:
This should proceed without any problems. When its done, edit the file /usr/local/apache/conf/httpd.conf and uncomment the following line:
This tells apache to allow PHP to process files with a .php extension. You may also want to add some other extensions to the end of this line, eg:
You now have all the software you need and are ready to test your system. 7. Test the SystemFirst, make sure Apache and Sybase are started:
Now go to the directory /usr/local/apache/htdocs. Create a file called test.php and insert the following contents:
Save the file and then access the following URL in your browser:
If you see some text, then congratulations! You have a complete Linux/Apache/PHP/Sybase-ASE installation. If not...well, there you go. Make sure you actually have installed the pubs2 database. If you are not sure, try running:
Email me if you have any problems, corrections (please!) or additions, but please do not email me unless you have tried everything in this howto! Thanks. 8. Post Install TasksAfter you have a working system, first of all, breath a deep sigh of satisfaction. (I also suggest eating something.) After this, there are a few post-install tasks you should perform. The FIRST thing you should do is change the password for the 'sa' user. By default this password is blank. To set a password for sa, type the following in isql:
This will set the password. You will now need to pass this as a parameter to sybase_connect. You will also need to specify it when starting isql, which you can do by using the '-P' switch.
You also may wish to install the Windows client tools. These can be found on a CD if you bought a cope of ASE from Sybase. Otherwise, if you are using the free 11.0.3.3 version, you can download a demo of ASE 12.0 for NT, and only install the 'ASE Plugin for Sybase Central', 'ASE ODBC Driver' and 'Sybase Central' components.
I am open to more hints to put in this section. |