Chapter 19. Perl and Python

 < Day Day Up > 

18.4. PHP and Perl

On Mac OS X Panther, MySQL support is built in to PHP. If you want PostgreSQL support, you must reinstall PHP from source.

You can install general database support in Perl by installing the DBI module with the cpan utility. After that, you can install the DBD::mysql module for MySQL-specific support, and DBD::Pg for PostgreSQL-specific support. Because there are some steps to these installations that the cpan utility can't handle, you should download the latest builds of these modules from http://www.cpan.org/modules/by-module/DBD/ and install them manually. Be sure to check the README files, since some aspects of the configuration may have changed.

The DBD:mysql module requires a database in which to perform its tests. You can use the database and username/password that you set up earlier in "Configuring MySQL." To install DBD::mysql, you must first generate the Makefile, compile the code, test it, and then install the module if the test run is successful. For example:

     $ perl Makefile.PL --testdb= dbname  --testuser= username  \      >  --testpassword= password      $ make      $ make test      $ sudo make install  

As with DBD::mysql, the DBD::Pg module needs a directory to perform its tests. If you'd like, you can use the database, username, and password that you set up earlier when configuring PostgreSQL.

You must first generate the Makefile, compile the code, set up environment variables that specify the database, username, and password, and then run the tests. If the tests run successfully, you can install DBD::Pg:

     $ perl Makefile.PL      $ make      $ export DBI_DSN=dbi:Pg:dbname= username      $ export DBI_USER= username      $ export DBI_PASS= password      $ make test      $ sudo make install  

     < Day Day Up > 


    Mac OS X Tiger for Unix Geeks
    Mac OS X Tiger for Unix Geeks
    ISBN: 0596009127
    EAN: 2147483647
    Year: 2006
    Pages: 176

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net