preg_match not defined in php4 in openwrt?

Posted by user2723949 on Stack Overflow See other posts from Stack Overflow or by user2723949
Published on 2013-10-25T15:52:01Z Indexed on 2013/10/25 15:53 UTC
Read the original article Hit count: 224

Filed under:
|

I have installed the packages PHP4 and PHP4-CGI in openwrt through command line (opkg install)

when I tried this simple code by putting this in the openwrt www folder,

<?php
$subject = "abcdef";
$pattern = '/^def/';
preg_match($pattern, $subject, $matches, PREG_OFFSET_CAPTURE, 3);
print_r($matches);
?>

I got this error

Fatal error: Call to undefined function: preg_match() in /www/phptest.php on line 4

but php manual says preg_match() is defined in php4 also.. What might be the reason for this error? Is there any other PHP module that is to be installed?
Or is there any alternate method for preg_match?

© Stack Overflow or respective owner

Related posts about php

Related posts about openwrt