Archive for the ‘PHP Tutorials’ Category

PEAR Installation with PEAR Installer (go-pear.org)

Friday, March 9th, 2007

Today I will describe you, how you can install the PEAR Framework on your shared hosting server or other servers.

In this post I wrote how to install Apache and PHP. I installed PEAR on this testerver too. My document root is

/usr/local/httpd/htdocs

. If you don’t know your document root make a little php-script with this code and browse it with your favourite browser.

<?
echo $_SERVER["DOCUMENT_ROOT"];
?>

Now if you know your document root on your server, you can beginn to install PEAR.

  1. Go to http://go-pear.org (important: without www). You can see a source code from a php script. Save this file as pearinstaller.php
  2. Create a new folder for PEAR on your document root e.g. _pear.
  3. Chmod your PEAR directory on your webserver with
    chmod 777
  4. Now put the downloadet pearinstaller in the _pear directory.
  5. Browse to this script with your webbrowser. e.g http://www.domain.tld/_pear/pearinstaller.php
  6. You should see the Installer Frontend. Click on the next-button.
  7. On the next site you have to configure your pearinstaller. In the field “Installation Prefix” should now stand something like this:
    /path/to/your/documentRoot/_pear
  8. Replace in the fields 4-7
    $php_dir

    with

    $prefix
  9. Start the installation. At the end of the installation you get a link. Click on it and you will come to the web frontend of the PEAR Installer
  10. The last step: You have to change something on the configuration mask.
PEAR documentation directory: => /path/to/your/documentRoot/_pear/docs
PEAR data directory: => /path/to/your/documentRoot/_pear/data
PEAR test directory: => /path/to/your/documentRoot/_pear/dtests

Approve it by clicking the Go!-Button

Now the PEAR Installer is installed now on your system. With the Web Frontend you can install and delete packages.
IMPORTANT: Delete the

pearinstaller.php

and protect the installdirectory with a

.htaccess

file

Resources:

How to IBM DB2 with PHP on Linux

Tuesday, March 6th, 2007

In the past I wrote an article how to connect to a IBM DB2 database with PHP on Windows. Now i need to connect from a Red Hat Enterprise Linux to the DB2 database. I have searched the internet for good tutorials. I have found a few, but these aren’t so good.
So I will describe here how to install PHP 5.2.1 with IBM DB2 support on an Apache 2.0.59.

First download the packages:

Copy the Packages to

/usr/local/src/lamp

and unpack it as root. To unpack both packages at the same time write this to your console:

for i in `ls *.gz`; do tar zxf $i; done;

In the next step will Apache be configured and compiled.

  1. Change the directory to the unpacked Apache directory:
    cd /usr/local/src/lamp/httpd-2.0.59
  2. Start the configure script
    ./configure --prefix=/usr/local/httpd \
    --enable-modules=all \
    --enable-so
  3. To compile Apache type
    make

    to your command line

  4. Install Apache with
    make install

To start Apache at boottime you will copy the startscript and create links to the runlevel 3.
Do this on your command line:

  1. cp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/httpd
  2. cd /etc/rc.d/rc3.d
  3. ln -s ../init.d/httpd S20httpd
  4. ln -s ../init.d/httpd K20httpd

Now set user and group of

/usr/local/httpd/htdocs

to nobody

chown -R nobody:nobody /usr/local/httpd/htdocs/

(more…)

Connecting to an IBM DB2 Database with PHP

Tuesday, February 13th, 2007

In my apprenticeship as computer scientist, I’m developing several applications. But now at the end of my apprenticeship i have an IPA (Individual productive work in german Individuelle Produktiv Arbeit). In this work I have to develop a webfrontend in PHP for an application that runs with IBM DB2.
I’ve searched the world wide web for an how to or a tutorial. But I don’t have found any clever hints.

Here is an expample how to connect PHP5 with a IBM DB2 Database in Windows!
(more…)