Domanda

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?

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top