schilly Posted August 26, 2008 Share Posted August 26, 2008 I'm running into this error on a friend's server: "PHP Fatal error: Call to undefined function preg_match()" I assume preg_match was installed by default. Is there an easy way to check this and/or fix this? PHP v5.2.6 thx. Link to comment https://forums.phpfreaks.com/topic/121335-solved-preg_match-undefined/ Share on other sites More sharing options...
schilly Posted August 26, 2008 Author Share Posted August 26, 2008 Ok ran this: <?php if (function_exists('preg_match')) { echo "preg_match available.<br />\n"; } else { echo "preg_match not available.<br />\n"; } ?> And it said it wasn't available. How do I enable it? Do I have to recompile PHP or is it an ini setting? Link to comment https://forums.phpfreaks.com/topic/121335-solved-preg_match-undefined/#findComment-625576 Share on other sites More sharing options...
DarkWater Posted August 26, 2008 Share Posted August 26, 2008 I think the PCRE module is installed by default, so every server should really have it. Is it his personal server or a hosted server? EDIT: I meant "IS installed by default". Wasn't paying attention. Link to comment https://forums.phpfreaks.com/topic/121335-solved-preg_match-undefined/#findComment-625577 Share on other sites More sharing options...
schilly Posted August 26, 2008 Author Share Posted August 26, 2008 I believe it's a full control hosted server. Can you tell by the phpinfo() print out? Link to comment https://forums.phpfreaks.com/topic/121335-solved-preg_match-undefined/#findComment-625579 Share on other sites More sharing options...
DarkWater Posted August 26, 2008 Share Posted August 26, 2008 I believe it's a full control hosted server. Can you tell by the phpinfo() print out? Yes, please send the full HTML source of the phpinfo() page. Or just show me the output of `php -m`. Link to comment https://forums.phpfreaks.com/topic/121335-solved-preg_match-undefined/#findComment-625580 Share on other sites More sharing options...
schilly Posted August 26, 2008 Author Share Posted August 26, 2008 Here is the configuration: './configure' '--prefix=/usr/local/php5' '--with-config-file-scan-dir=/usr/local/php5/etc' '--with-apxs2=/usr/local/apache2/bin/apxs' '--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local' '--enable-reflection' '--disable-cli' '--disable-cgi' '--enable-zend-multibyte' '--with-regex=system' > php -m date libxml Reflection standard [Zend Modules] > Link to comment https://forums.phpfreaks.com/topic/121335-solved-preg_match-undefined/#findComment-625597 Share on other sites More sharing options...
DarkWater Posted August 26, 2008 Share Posted August 26, 2008 Wow, they actually turned off PCRE? That's SO odd. E-mail them and ask them to add --with-pcre-regex. Link to comment https://forums.phpfreaks.com/topic/121335-solved-preg_match-undefined/#findComment-625598 Share on other sites More sharing options...
schilly Posted August 26, 2008 Author Share Posted August 26, 2008 I have full access and probably more knowledge than my friend. Is this an easy fix? I've never done a manual compile of php. Link to comment https://forums.phpfreaks.com/topic/121335-solved-preg_match-undefined/#findComment-625602 Share on other sites More sharing options...
DarkWater Posted August 26, 2008 Share Posted August 26, 2008 PHP is pretty easy to install, but it can take a while if it's your first compilation of that version. cd ~/place_where_you_untared_php ./configure --with-pcre-regex #and other stuff! make sudo make install Link to comment https://forums.phpfreaks.com/topic/121335-solved-preg_match-undefined/#findComment-625912 Share on other sites More sharing options...
aschk Posted August 26, 2008 Share Posted August 26, 2008 Wow, i loved seeing the '--disable-all' part of that php build string! There's security and then there's paranoia Link to comment https://forums.phpfreaks.com/topic/121335-solved-preg_match-undefined/#findComment-625919 Share on other sites More sharing options...
DarkWater Posted August 26, 2008 Share Posted August 26, 2008 Wow, i loved seeing the '--disable-all' part of that php build string! There's security and then there's paranoia I know, I loved that part too! I've never seen that option used at all, ever. O_O Good thing you can't disable PCRE in PHP 5.3>. Link to comment https://forums.phpfreaks.com/topic/121335-solved-preg_match-undefined/#findComment-625926 Share on other sites More sharing options...
schilly Posted August 26, 2008 Author Share Posted August 26, 2008 Thanks for you help guys. I think I should be good now. Link to comment https://forums.phpfreaks.com/topic/121335-solved-preg_match-undefined/#findComment-626098 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.