Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to run a Perl script because I need a module that Perl has that PHP does not.

This is my code for testing purposes in PHP


echo ("Hello World");

$perl = new Perl();

I got

Hello WorldPHP Fatal error:  Class 'Perl' not found in /var/virtual/ on line 7
PHP Stack trace:
PHP   1. {main}() /var/virtual/

Then I tried to install to no avail.

What should I do to get Perl running inside a ubuntu 12.10 server edition?

share|improve this question

migrated from Jan 24 '13 at 2:27

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted

This answer works as of 29 Jan 2013.

First of all, inside ubuntu do


to download the tgz file from

Unzip the tar

tar -zxvf perl-1.0.1.tgz

Go into the uncompressed folder

cd perl-1.0.1

Remove the current php_perl.c because for some reason, it did not work with my php5.

Download another php_perl.c from github repo


Run this line by line

export PHP_PREFIX="/usr"
export PERL_PREFIX="/usr"
./configure --with-perl=$PERL_PREFIX --with-php-config=$PHP_PREFIX/bin/php-config

If you get errors like /usr/bin/ld: cannot find -lperl, then you need to install

sudo apt-get install libperl-dev

Install the extension (this step can require root privileges)

make install

Add perl extension into your php.ini (this step can require root privileges)

Restart your php5-fpm

sudo /etc/init.d/php5-fpm restart

You may get issues to do with locale when you run Perl.

Look at the missing locales. Assuming you have missing en_SG and en_SG.UTF-8


sudo locale-gen en_SG en_SG.UTF-8
sudo dpkg-reconfigure locales

and then reboot.

If you still have locale issues,


sudo nano /etc/environment

Append the missing locale to LC_ALL

LC_ALL = "en_SG.UTF-8"


I want to thank tm064 from #perl and NullDev from #ubuntu for helping me with this solution.

share|improve this answer… is now broken. It does not match with the latest header file. – rht Apr 28 '13 at 15:22

There is a newer version of perl-1.0.1.tgz available from 2013-01-23. It has more adequate package.xml (Tried under SuSE 12.2 - everything is OK).

share|improve this answer
I am using ubuntu 12.10. I cannot get it to work. I got make: *** [php_perl.lo] Error 1 ERROR: `make' failed – Kim Stacks Jan 29 '13 at 1:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .