1757b
![]() |
|
|
|
|
|||||||
| Installation and Maintenance of FreeBSD Ports or Packages Installing and maintaining the FreeBSD Ports Collection or FreeBSD Packages (i.e. third party software). |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi all,
I'm trying to get php5-pcre working with utf-8 support. Here is the test case: <?php if (@preg_match('/\pL/u', 'a') == 1) { echo "PCRE unicode support is turned on.\n"; } else { echo "PCRE unicode support is turned off.\n"; } ?> And the result is "PCRE unicode support is turned off". I have the following installed: # pkg_info |grep pcre pcre-7.8 Perl Compatible Regular Expressions library php5-pcre-5.2.6_2 The pcre shared extension for php And this is the output from pcretest -C: PCRE version 7.8 2008-09-05 Compiled with UTF-8 support Unicode properties support Newline sequence is LF \R matches all Unicode newlines Internal link size = 2 POSIX malloc threshold = 10 Default match limit = 10000000 Default recursion depth limit = 10000000 Match recursion uses stack I'm using FreeBSD 6 stable. This is the output from uname: FreeBSD xxxx 6.3-STABLE FreeBSD 6.3-STABLE #2: Mon Aug 4 16:50:44 EEST 2008 I tried to reinstall pcre and php5-pcre, but the result is the same. Any suggestions are welcome. Tanks in advance ! |
|
#2
|
|||
|
|||
|
I think your test case should be:
if (@preg_match('/\p{L}/u', 'a') == 1) { |
|
#3
|
|||
|
|||
|
The test case is changed, but the result is still:
"PCRE unicode support is turned off." |
|
#4
|
|||
|
|||
|
That is strange. Did you install from ports? Mine works:
Code:
$ php -q
<?
if (@preg_match('/\p{L}/u', 'a') == 1) {
echo "PCRE unicode support is turned on.\n";
} else {
echo "PCRE unicode support is turned off.\n";
}
?>
PCRE unicode support is turned on.
$ pkg_info -xI php
php5-5.2.6 PHP Scripting Language
php5-ctype-5.2.6 The ctype shared extension for php
php5-dom-5.2.6 The dom shared extension for php
php5-gettext-5.2.6_1 The gettext shared extension for php
php5-mbstring-5.2.6 The mbstring shared extension for php
php5-mhash-5.2.6 The mhash shared extension for php
php5-mysql-5.2.6 The mysql shared extension for php
php5-openssl-5.2.6_2 The openssl shared extension for php
php5-pcre-5.2.6 The pcre shared extension for php
php5-pdo-5.2.6 The pdo shared extension for php
php5-pdo_mysql-5.2.6 The pdo_mysql shared extension for php
php5-pdo_sqlite-5.2.6_1 The pdo_sqlite shared extension for php
php5-session-5.2.6 The session shared extension for php
php5-simplexml-5.2.6 The simplexml shared extension for php
php5-spl-5.2.6 The spl shared extension for php
php5-wddx-5.2.6 The wddx shared extension for php
php5-xml-5.2.6 The xml shared extension for php
php5-xmlreader-5.2.6_1 The xmlreader shared extension for php
php5-xmlrpc-5.2.6_2 The xmlrpc shared extension for php
php5-xsl-5.2.6 The xsl shared extension for php
php5-zlib-5.2.6 The zlib shared extension for php
|
|
#5
|
|||
|
|||
|
Quote:
|
|
#6
|
||||
|
||||
|
Maybe you have to set a locale with UTF-8.
__________________
sysutils/bsdadminscripts: binary package maintenance, library integrity checking, ... sysutils/automounter: amd(8) based automounting without HAL contact: kamikaze@bsdforen.de Disclaimer: My posts represent my perception. Errors and incompleteness are to be expected, I deny any responsibility to know everything. |
|
#7
|
|||
|
|||
|
I modified /etc/login.conf inserting the following line in default section:
Code:
:charset=UTF-8:\ Code:
cap_mkdb /etc/login.conf Code:
portupgrade -Df php5* Code:
# php test.php PCRE unicode support is turned off. |
|
#8
|
|||
|
|||
|
Try install the pcre module from a package build.
|
|
#9
|
|||
|
|||
|
Obviously the problem it's not into the port, because with the package the result is the same. It's something else ..
|
|
#10
|
|||
|
|||
|
Could you show:
Code:
make -C /usr/ports/lang/php5 showconfig |
|
#11
|
|||
|
|||
|
Code:
# make -C /usr/ports/lang/php5 showconfig
===> The following configuration options are available for php5-5.2.6_2:
CLI=on "Build CLI version"
CGI=off "Build CGI version"
APACHE=on "Build Apache module"
DEBUG=off "Enable debug"
SUHOSIN=on "Enable Suhosin protection system (not for jails)"
MULTIBYTE=on "Enable zend multibyte support"
IPV6=off "Enable ipv6 support"
MAILHEAD=on "Enable mail header patch"
REDIRECT=off "Enable force-cgi-redirect support (CGI only)"
DISCARD=off "Enable discard-path support (CGI only)"
FASTCGI=on "Enable fastcgi support (CGI only)"
PATHINFO=on "Enable path-info-check support (CGI only)"
===> Use 'make config' to modify these settings
|
|
#12
|
||||
|
||||
|
Perhaps this is a silly question - but... (if you are using mod_php5) did you restart apache after rebuilding PCRE extension?
|
|
#13
|
|||
|
|||
|
Well, the usual suspect, multibyte zend is on. Next up: mbstring extension is loaded? And the internal encoding:
Code:
php -i |grep internal_encoding |
|
#14
|
|||
|
|||
|
Quote:
Code:
php -i |grep internal_encoding iconv.internal_encoding => ISO-8859-1 => ISO-8859-1 mbstring.internal_encoding => ISO-8859-1 => no value |
|
#15
|
|||
|
|||
|
I know its old - Google doesn't care though! Try running your test script on the command line i.e
php xxx.php and see if that works. I found with apache-2.2.21 and php5-5.3.8 I needed to add Code:
AddDefaultCharset utf8 to httpd.conf |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Solved] Problems installing Unreal Tournament | phreud | Installation and Maintenance of FreeBSD Ports or Packages | 8 | January 17th, 2011 18:50 |
| lcUTF8.c error when installing php5-extensions? | Lobster | Installation and Maintenance of FreeBSD Ports or Packages | 2 | November 23rd, 2008 11:08 |
| Some problems with CARP | sibdoma | Firewalls | 5 | November 20th, 2008 12:18 |
| problems setting up PolicyKit in FreeBSD 6.3 | kantor | General | 5 | November 18th, 2008 17:31 |
| Problems | vermaden | Feedback | 5 | November 16th, 2008 22:36 |