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?

有帮助吗?

解决方案

Change the function preg_match() (PCRE) into ereg, It works for php4 in openwrt.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top