So I get everything working, and config'd (at least that's what I think). Mysql, php, apache, etc all working. When I try to go to http://server/drupal/index.php, I get this weird error that points to a unicode.inc file.

The error is "Fatal error: Call to undefined function preg_match() in /usr/local/www/data-dist/drupal/includes/unicode.inc on line 32".

I vi the file and find that the function says:

30 // Check for outdated PCRE library
31 // Note: we check if U+E2 is in the range U+E0 - U+E1. This test returns TRUE on old PCRE versions.
32 if (preg_match('/[\xc3\xa0-\xc3\xa1]/u', '\xc3\xa2')) {
33 if ($errors) {
34 form_set_error('unicode', t('The PCRE library in your PHP installation is outdated. This will cause problems whe
n handling Unicode text. If you are running PHP 4.3.3 or higher, make sure you are using the PCRE library supplied by PHP. Ple
ase refer to the PHP PCRE documentation for more information.', array('%url' => 'http://www.php.net/pcre'))
);
35 }
36 return UNICODE_ERROR;
37 }

The error is actually coming from the "if(preg_match)..." line of code. The comments say to upgrade my PCRE, but it doesn't even look like it's getting to that error message. It seems like it's erring before the code can be run. Anybody have a clue what might be going on here?

Oh btw, I'm running FreeBSD 5.4, drupal 4.7 beta, mysql323,apache 1.33, php 5.0.3

apache modules:

Loaded Modules mod_php5, mod_setenvif, mod_so, mod_unique_id, mod_log_forensic, mod_usertrack, mod_headers, mod_expires, mod_cern_meta, mod_proxy, mod_digest, mod_auth_db, mod_auth_anon, mod_auth, mod_access, mod_rewrite, mod_alias, mod_userdir, mod_speling, mod_actions, mod_imap, mod_asis, mod_cgi, mod_dir, mod_autoindex, mod_include, mod_info, mod_status, mod_negotiation, mod_mime, mod_mime_magic, mod_log_config, mod_env, mod_vhost_alias, mod_mmap_static, http_core

Comments

robertDouglass’s picture

preg_match is a standard PHP function, even in 5.0.3

http://de2.php.net/manual/en/function.preg-match.php

There must be something wrong with your PHP. Did you compile it yourself?

- Robert Douglass

-----
My Drupal book: Building Online Communities with Drupal, phpBB and WordPress

my Drupal book | Twitter | Director, Product Operations Commerce Guys

gum5h03’s picture

Yes, I compiled it myself.

gum5h03’s picture

php -i shows everything as ok I think. I included it below, minus the IP's of course...

phpinfo()
PHP Version => 5.0.3

System => FreeBSD 5.4-RELEASE FreeBSD 5.4-RELEASE #0: Sun May 8 10:21:06 UTC 2005 root@harlow.cse.buffalo.edu:
/usr/obj/usr/src/sys/GENERIC i386
Build Date => Apr 4 2005 06:58:51
Configure Command => './configure' '--enable-versioning' '--enable-memory-limit' '--with-layout=GNU' '--with-config-file-scan
-dir=/usr/local/etc/php' '--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local' '--enable-spl' '--with-regex=php' '-
-with-apxs=/usr/local/sbin/apxs' '--prefix=/usr/local' 'i386-portbld-freebsd5.4'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /usr/local/etc
Scan this dir for additional .ini files => /usr/local/etc/php
PHP API => 20031224
PHP Extension => 20041030
Zend Extension => 220040412
Debug Build => no
Thread Safety => disabled
IPv6 Support => enabled
Registered PHP Streams => php, file, http, ftp
Registered Stream Socket Transports => tcp, udp, unix, udg

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies

_______________________________________________________________________

Configuration

PHP Core

Directive => Local Value => Master Value
allow_call_time_pass_reference => On => On
allow_url_fopen => On => On
always_populate_raw_post_data => Off => Off
arg_separator.input => & => &
arg_separator.output => & => &
asp_tags => Off => Off
auto_append_file => no value => no value
auto_globals_jit => On => On
auto_prepend_file => no value => no value
browscap => no value => no value
default_charset => no value => no value
default_mimetype => text/html => text/html
define_syslog_variables => Off => Off
disable_classes => no value => no value
disable_functions => no value => no value
display_errors => On => On
display_startup_errors => Off => Off
doc_root => no value => no value
docref_ext => no value => no value
docref_root => no value => no value
enable_dl => On => On
error_append_string => no value => no value
error_log => no value => no value
error_prepend_string => no value => no value
error_reporting => no value => no value
expose_php => On => On
extension_dir => /usr/local/lib/php/20041030 => /usr/local/lib/php/20041030
file_uploads => On => On
highlight.bg => #FFFFFF => #FFFFFF
highlight.comment => #FF8000 => #FF8000
highlight.default => #0000BB => #0000BB
highlight.html => #000000 => #000000
highlight.keyword => #007700 => #007700
highlight.string => #DD0000 => #DD0000
html_errors => Off => On
ignore_repeated_errors => Off => Off
ignore_repeated_source => Off => Off
ignore_user_abort => Off => Off
implicit_flush => On => Off
include_path => .: => .:
log_errors => Off => Off
log_errors_max_len => 1024 => 1024
magic_quotes_gpc => On => On
magic_quotes_runtime => Off => Off
magic_quotes_sybase => Off => Off
mail.force_extra_parameters => no value => no value
max_execution_time => 0 => 30
max_input_time => -1 => -1
memory_limit => 8M => 8M
open_basedir => no value => no value
output_buffering => 0 => 0
output_handler => no value => no value
post_max_size => 8M => 8M
precision => 14 => 14
register_argc_argv => On => On
register_globals => Off => Off
register_long_arrays => On => On
report_memleaks => On => On
report_zend_debug => Off => Off
safe_mode => Off => Off
safe_mode_exec_dir => /usr/local/php/bin => /usr/local/php/bin
safe_mode_gid => Off => Off
safe_mode_include_dir => no value => no value
sendmail_from => no value => no value
sendmail_path => /usr/sbin/sendmail -t -i => /usr/sbin/sendmail -t -i
serialize_precision => 100 => 100
short_open_tag => On => On
SMTP => localhost => localhost
smtp_port => 25 => 25
sql.safe_mode => Off => Off
track_errors => Off => Off
unserialize_callback_func => no value => no value
upload_max_filesize => 2M => 2M
upload_tmp_dir => no value => no value
user_dir => no value => no value
variables_order => EGPCS => EGPCS
xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off
y2k_compliance => On => On
zend.ze1_compatibility_mode => Off => Off

libxml

libXML support => active
libXML Version => 2.6.18
libXML streams => enabled

SPL

SPL support => enabled
Interfaces => RecursiveIterator, SeekableIterator
Classes => ArrayObject, ArrayIterator, CachingIterator, CachingRecursiveIterator, DirectoryIterator, FilterIterator, LimitIter
ator, ParentIterator, RecursiveDirectoryIterator, RecursiveIteratorIterator

standard

Regex Library => Bundled library enabled
Dynamic Library Support => enabled
Path to sendmail => /usr/sbin/sendmail -t -i

Directive => Local Value => Master Value
assert.active => 1 => 1
assert.bail => 0 => 0
assert.callback => no value => no value
assert.quiet_eval => 0 => 0
assert.warning => 1 => 1
auto_detect_line_endings => 0 => 0
date.default_latitude => 31.7667 => 31.7667
date.default_longitude => 35.2333 => 35.2333
date.sunrise_zenith => 90.83 => 90.83
date.sunset_zenith => 90.83 => 90.83
default_socket_timeout => 60 => 60
safe_mode_allowed_env_vars => PHP_ => PHP_
safe_mode_protected_env_vars => LD_LIBRARY_PATH => LD_LIBRARY_PATH
url_rewriter.tags => a=href,area=href,frame=src,form=,fieldset= => a=href,area=href,frame=src,form=,fieldset=
user_agent => no value => no value

Additional Modules

Module Name

Environment

Variable => Value
USER => root
LOGNAME => root
HOME => /root
MAIL => /var/mail/root
PATH => /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/root/bin
TERM => xterm
BLOCKSIZE => K
FTP_PASSIVE_MODE => YES
SHELL => /bin/csh
SSH_CLIENT =>
SSH_CONNECTION =>
SSH_TTY => /dev/ttyp0
HOSTTYPE => FreeBSD
VENDOR => intel
OSTYPE => FreeBSD
MACHTYPE => i386
SHLVL => 2
PWD => /usr/local/www
GROUP => wheel
HOST => apprentice
REMOTEHOST =>
EDITOR => vi
PAGER => more

PHP Variables

Variable => Value
_SERVER["USER"] => root
_SERVER["LOGNAME"] => root
_SERVER["HOME"] => /root
_SERVER["MAIL"] => /var/mail/root
_SERVER["PATH"] => /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/root/bin
_SERVER["TERM"] => xterm
_SERVER["BLOCKSIZE"] => K
_SERVER["FTP_PASSIVE_MODE"] => YES
_SERVER["SHELL"] => /bin/csh
_SERVER["SSH_CLIENT"] =>
_SERVER["SSH_CONNECTION"] =>
_SERVER["SSH_TTY"] => /dev/ttyp0
_SERVER["HOSTTYPE"] => FreeBSD
_SERVER["VENDOR"] => intel
_SERVER["OSTYPE"] => FreeBSD
_SERVER["MACHTYPE"] => i386
_SERVER["SHLVL"] => 2
_SERVER["PWD"] => /usr/local/www
_SERVER["GROUP"] => wheel
_SERVER["HOST"] => apprentice
_SERVER["REMOTEHOST"] =>
_SERVER["EDITOR"] => vi
_SERVER["PAGER"] => more
_SERVER["PHP_SELF"] =>
_SERVER["SCRIPT_NAME"] =>
_SERVER["SCRIPT_FILENAME"] =>
_SERVER["PATH_TRANSLATED"] =>
_SERVER["DOCUMENT_ROOT"] =>
_SERVER["argv"] => Array
(
)

_SERVER["argc"] => 0
_ENV["USER"] => root
_ENV["LOGNAME"] => root
_ENV["HOME"] => /root
_ENV["MAIL"] => /var/mail/root
_ENV["PATH"] => /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/root/bin
_ENV["TERM"] => xterm
_ENV["BLOCKSIZE"] => K
_ENV["FTP_PASSIVE_MODE"] => YES
_ENV["SHELL"] => /bin/csh
_ENV["SSH_CLIENT"] =>
_ENV["SSH_CONNECTION"] =>
_ENV["SSH_TTY"] => /dev/ttyp0
_ENV["HOSTTYPE"] => FreeBSD
_ENV["VENDOR"] => intel
_ENV["OSTYPE"] => FreeBSD
_ENV["MACHTYPE"] => i386
_ENV["SHLVL"] => 2
_ENV["PWD"] => /usr/local/www
_ENV["GROUP"] => wheel
_ENV["HOST"] => localhost
_ENV["REMOTEHOST"] => xxx.xxx.xxx.xxx
_ENV["EDITOR"] => vi
_ENV["PAGER"] => more

aellwein’s picture

Hi,

in FreeBSD it seems that PCRE are outside the core PHP4 distribution. I just had the similar problem,
the solution is to install php4-pcre package:

$ pkg_add -r php4-pcre

In your case, you should probably install it with portinstall.

Regards.

--
Alexander Ellwein

--
Alexander Ellwein

goggie’s picture

For FreeBSD using php5.x and above you must use the port "php5-pcre-x.x.x" . The correct current version can be found by typing

#cd /usr/ports/devel/
#ls php5-pcre-*

cd to the correct directory and then a simple

#make
#make install
#make clean

will fix the problem. (FYI, I prefer to use 3 commands to check if all compiled OK.)

You can either simply reboot or send a HUP signal to Apache and SQL server.