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
<?php
echo ("Hello World");
$perl = new Perl();
$perl->require("someperlscript.pl");
I got
Hello WorldPHP Fatal error: Class 'Perl' not found in /var/virtual/abc.com/testperl/testperl.php on line 7
PHP Stack trace:
PHP 1. {main}() /var/virtual/abc.com/testperl/testperl.php:0
Then I tried to install to no avail.
What should I do to get Perl running inside a ubuntu 12.10 server edition?
Best Answer
This answer works as of 29 Jan 2013.
First of all, inside ubuntu do
to download the tgz file from http://pecl.php.net/package/perl
Unzip the tar
Go into the uncompressed folder
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 https://github.com/do-aki/php-ext-perl
Run this line by line
If you get errors like
/usr/bin/ld: cannot find -lperl
, then you need to installInstall the extension (this step can require root privileges)
Add perl extension into your php.ini (this step can require root privileges)
Restart your php5-fpm
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
Try
and then reboot.
If you still have locale issues,
Try
Append the missing locale to LC_ALL
Reboot.
I want to thank
tm064
from #perl andNullDev
from #ubuntu for helping me with this solution.