Archive for the ‘LAMP’ Category

PHP Perl Class

Hello,

I have a bit of problem combining PHP and Perl language.

I am trying to pass Perl variables into PHP and keep getting this error

“PHP Fatal error: Class ‘Perl’ not found in /var/www/html/hidden.php on line 3

find attached copy of my script.

Regards,
Customer

Naturally, I thought the customer was crazy. Then I looked at the script:

$perl = new Perl();
$perl->require(“userexit.pl”);

I lol’ed and then search, it seems the Perl class is provided by the Zend people in the form of a php extension, which is, fortunately, in pecl.

Unfortunately, this package seems to be broken :)

( ~ ) pecl install perl
Package “perl” Version “1.0.0″ does not have REST xml available
install failed

I did some searching and found an ‘open’ bug report:
16807

Rather than did too deep, I decided to just install the module manually for the customer.

# wget http://pecl.php.net/get/perl-1.0.0.tgz
# tar xzfv perl-1.0.0.tgz
# cd perl-1.0.0
# phpize
# ./configure
# make
# make install

Now edit your php.ini to include:

extension=perl.so

Or on Red Hat/Fedora, simply:

echo “extension=perl.so” > /etc/php.d/perl.ini

Don’t forget to restart apache.

viola:

# php -v ; php -m | grep perl
PHP 5.1.6 (cli) (built: Feb 26 2009 07:01:12)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
perl

As always, be careful when installing unmanaged modules. Future updates to php may introduce instability when depending modules are not rebuilt with the new symbol table.

Happy Hacking.

Installing APC

APC (http://us2.php.net/apc, http://en.wikipedia.org/wiki/PHP_accelerator) is a bytecode caching mechanism for php that greatly increase the performance of php applications. APC is available from pecl and easy to install on most LAMP platforms.


pear channel-update pecl.php.net
mount -o remount,exec /tmp
pecl install apc
mount -o remount,noexec /tmp
echo "extension=apc.so" >/etc/php.d/apc.ini
echo "apc.shm_size=128" >>/etc/php.d/apc.ini

Please keep in mind, apc.ini must reside in a directory that is scanned by php. Also, RHEL3-4 users may have issues updating pear.

On RHEL3, something like this will happen:

pear upgrade pear

pear install something

-bash: pear: command not found

pear will then need to be installed manually:
lynx -source http://pear.php.net/go-pear | php -q

On RHEL4, the issue is that the url had changed to grab packages from pear.php.net. This can be resolved by upgrading to the latest version of pear using the full URL:

pear upgrade http://pear.php.net/get/pear http://pear.php.net/get/dependency

WordPress install

Well, I have installed wordpress for grins at 7am on my work provided server. It seems slow so I installed apc to speed some things up. I am working on gentoo, as I have never used gentoo as a LAMP platform, somethings are taking some getting used to. For instance:

112364-www1 APC-3.0.17 # make install
Installing shared extensions: /usr/lib/php5/lib/php/extensions/no-debug-non-zts-20060613/

Now that is an odd place for my extensions, regardless, hopefully apc will speed things up a bit.

Return top