OVH Cloud OVH Cloud

probleme avec preg_match() PHP 5

1 réponse
Avatar
did
Salut

Je m'essai a php et a smarty. Seulement, je suis confronté a un petit
probleme. Je voudrais utiliser la fonction display de smarty, mais
j'obtient le ligne suivante :

Fatal error: Call to undefined function preg_match() in
/usr/local/lib/php/smarty/Smarty.class.php on line 1632

Je me suis dit que j'allais essayer cette fonction dans un fichier a
part pour voir:

<?

// the "i" after the pattern delimiter indicates a case-insensitive search

if (preg_match ("/php/i", "PHP is the web scripting language of choice.")) {

print "A match was found.";

} else {

print "A match was not found.";

}

?>

Et à l'execution, j'obtient l'erreur suivante :

Fatal error: Call to undefined function preg_match_all() in
/usr/local/www/data/myapp/preg.php on line 6

Que faut-il faire pour que preg_match fonctionne?

Merci de m'éclairer parce que là, je patauge dur...

did

ps :

:-) php --version
PHP 5.0.4 (cli) (built: Apr 15 2005 13:57:51)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies

:-) uname -v
FreeBSD 5.3-RELEASE #2

1 réponse

Avatar
Daniel Dupont

Fatal error: Call to undefined function preg_match() in
/usr/local/lib/php/smarty/Smarty.class.php on line 1632


Est-il possible que ton binaire php ne soit pas compilé avec PCRE ?
À vérifier avec un 'phpinfo()'.

<?

// the "i" after the pattern delimiter indicates a case-insensitive search

if (preg_match ("/php/i", "PHP is the web scripting language of
choice.")) {

print "A match was found.";

} else {

print "A match was not found.";

}

?>

Et à l'execution, j'obtient l'erreur suivante :

Fatal error: Call to undefined function preg_match_all() in
/usr/local/www/data/myapp/preg.php on line 6


C'est bizarre que php te dise que 'preg_match_all()' n'existe pas alors
que tu appelles 'preg_match()' ?

A+

--
Daniel Dupont