How to get Pl/PHP and PL/PERL installed?

Dragonlordgod

Account Disabled
My friend is having A LOT of trouble getting it installed. Any help would be appreciated. Hope this is in the correct forum.

Thanks again! :thumbup:
 
Last edited:
Would you mind telling me what kind of setup you have?
OS, type of server, current configuration thus far?
With those questions answered, I'm sure we wouldn't have any trouble getting this whole problem sorted out for you!
Regards,
~Equinox
 
If you're trying to "roll your own" or install PHP and a Perl/CGI module on a *nix machine, here's the intructions:

Requirements
- Shell Access (if you don't have shell access ask your host)
- A copy of php 4.3.2 tar.gz (or any PHP version) which can be obtained here: http://museum.php.net/php4/php-4.3.2.tar.gz
- Some knowlegde of shell & shell commands

Instructions
1. Download php-4.3.2.tar.gz from the above source
2. Upload php-4.3.2.tar.gz to your user root directory (right outside of your public_html directory)

3. Login using shell, and enter the following comands:
Code:
gunzip php-4.3.2.tar.gz

Then:
Code:
tar -xf php-4.3.2.tar

4. You will now need to cd into that directory, using the following command (replace [USERNAME] with your own username or your customer's username)
Code:
cd /home/[USERNAME]/php-4.3.2

5. You may now begin the installation, using the following command (replace [USERNAME] with your own username or your customer's username):
Note
This is all one line:
Code:
'./configure' '--with-mysql' '--enable-force-cgi-redirect' '--with-config-file-path=/home/[USERNAME]/local/etc/' '--enable-trans-sid' '--enable-ftp' '--with-xml' '--with-zlib' '--prefix=/home/[USERNAME]/local' '--without-pear' '--with-gd' '--with-jpeg-dir=/usr/lib'

6. Once this completes, type the following command:
Code:
make

Then:
Code:
make install prefix=$HOME

7. Now you will need to move the resulting binary file to a cgi-bin under your public_html folder. Use the following command to do that (replace [USERNAME] with your own username or your customer's username):
Code:
cp /home/[USERNAME]/bin/php /home/[USERNAME]/public_html/cgi-bin
8. Navigate to your public_html/cgi-bin direcory using an ftp client, and change the name of the php binary from php to php.cgi

9. Now cp the file php.ini-recommended to the cgi-bin and change the name to php.ini using the following command (replace [USERNAME] with your own username or your customer's username):
Code:
cp /home/[USERNAME]/php-4.3.2/php.ini-recommended /home/[USERNAME]/public_html/cgi-bin/
10. Now you will need to create an .htaccess file in your public_html directory to tell php where your new php install is. So create an .htaccess file, and put the following in it:
Code:
AddHandler php-cgi .php 
Action php-cgi /cgi-bin/php.cgi
Note
If there is already an htaccess file located in your public_html folder, it is important that you download the htaccess file, and add the above code to the file, then re-upload. If you don't, you will overwrite your existing htaccess file, and may cause some of the changes you made (including redirects, etc)

11. Set the permissions on the .htaccess file as such: chmod 0644

12. Test the installation by creating a php file, called: phpinfotest.php, and place the following code in it:
Code:
<?php
phpinfo();
?>
Upload it to any public directory on your site, and use a browser to view it.

It should contain the php installation information for your newly installed php.

Make sure to pay particular attention to the "Server API" section of the above test page. The value should be "CGI" If it's not, then your installation did not take.

Also pay attention to the "Configuration File (php.ini) Path" it should now be "/home/[USERNAME]/public_html/cgi-bin/php.ini"

WARNING
If you do not feel comfortable doing the above, then please do not attempt it. Any mistakes may cause configuration problems with your account, and may take some time to pinpoint and fix. So if you would like to install php in your local account, or one of your customer's accounts, but do not feel comfortable with the above, ask your host if they will do it for you.
 
Mark,
very nice writeup! The only thing missing from it is a slightly modified step 1:
Get a soda.

:)
 
Very impressive post Mark. I was on my way to start a writeup of my own, until I saw yours...guess I cant compete, can I :(
~Equinox
 
Ahhh. In that case, for PHP:

1. Grab a soda ;) then download the following files:

pl/PHP
--------------------
http://www.avidinteractive.com/HD/plphp-7.4.x.tar.bz2
http://www.avidinteractive.com/HD/plphp-8.x.tar.bz2

PHP
--------------------
Supported versions are 4.3.8+ or 5.0.2+.
See http://www.php.net/downloads/

PostgreSQL
--------------------
Supported versions are 7.4.5, 7.4.6, and 8.x.
See http://www.postgresql.org/download/

2. Unpack the tarballs for PHP, and PostgreSQL (leave the plphp
tarball alone for now; we'll use it later!).

a. If you downloaded a GZIP file.

Code:
         tar -xvzf filename.tar.gz
         tar -xvzf filename.tgz

b. If you downloaded a BZIP2 file.
Code:
         tar -xvjf filename.tar.bz2
3. Build your PHP library with everything disabled.
Code:
      cd php-<version>
Then
Code:
      ./configure --disable-all
Then
Code:
      make libphp4.la (or libphp5.la, if using PHP5)
4. Run 'autoconf' in the postgresql directory.
Code:
      cd postgresql-<version>
then
Code:
      autoconf
5. Apply the plphp patch to your PostgreSQL source.
Code:
tar xvjf plphp-<version>.x.tar.bz2 plphp.patch
then
Code:
      patch -p1 < ../plphp.patch
6. Configure PostgreSQL with your PHP source (use an absolute
path).
Code:
      ./configure --with-php=/path/to/php-<version>
7. Build and install your plphp.so library.
Code:
      cd src/pl/plphp
then
Code:
      make && make install
8. Start postmaster and execute following sql to create plphp
language:
Code:
      CREATE FUNCTION plphp_call_handler() RETURNS LANGUAGE_HANDLER
      AS 'plphp' LANGUAGE C;

      CREATE TRUSTED LANGUAGE plphp HANDLER plphp_call_handler;
 
Unfortunately, I'm not very familiar with PL/Perl.

However, I will check around, and if I get any good news, I'll post it.
 
I believe pl/perl comes with the postgresql-pl RPM that you can install depending on the version of PostgreSQL you are running and provided you installed from an RPM in the first place.

Roj
 
Back
Top