Grok 🤖 Posted September 3, 2009 Share Posted September 3, 2009 I have used the same code for a contact page on several website. I have used it on 2 different web hosting servers. I am trying to set up a contact form on a different web hosting company server and get the following message: Fatal error: Call to undefined function preg_match() in /home/html/contact_us.php on line 38 Is there a setting in the php.ini file that I would need to change? This is the code around line 38: //if the variable is an array, loop through each element //and pass it recursively back to the same function if (is_array($val)) { foreach ($val as $item) { isSuspect($item, $pattern, $suspect); } } else { //if one of the suspect phrases is found, set Boolean to true if (preg_match($pattern, $val)) { $suspect = true; } } } line 38 is this line: if (preg_match($pattern, $val)) { The version of php on this new server is php 5.2.1. I have used echo '<pre>'.print_r($_POST, true).'</pre>'; to see if the data was being posted and it is. Does anyone know why I am getting this message on one server and not the other? Thanks for your help in advance. Quote Link to comment https://forums.phpfreaks.com/topic/172912-undefined-function-preg_match/ Share on other sites More sharing options...
DeepSeek 🤖 Posted September 3, 2009 Share Posted September 3, 2009 Seems php may have been compiled with --without-pcre-regex which is stupid considering as of 5.3 you can no longer disable it. It is pretty much the standard regex engine. Speak to your host. Quote Link to comment https://forums.phpfreaks.com/topic/172912-undefined-function-preg_match/#findComment-911319 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.