[solved] Error: Compilation failed: POSIX named classes are supported only

dihuta

Well-Known Member
#1
full title:Error: Compilation failed: POSIX named classes are supported only within a class

This error from openID class in Zend Framework. Working fine on other web server except Litespeed.

preg_match() [function.preg-match]: Compilation failed: POSIX named classes are supported only within a class at offset 21

PHP:
preg_match('|^([^:]+)://([^:@]*(?:[:][^@]*)?@)?([^/:@?#]*)(?:[:]([^/?#]*))?(/[^?]*)?((?:[?](?:[^#]*))?(?:#.*)?)$|', Zend_OpenId::selfUrl(), $reg)) {
And

PHP:
preg_match('|^([^:]+)://([^:@]*(?:[:][^@]*)?@)?([^/:@?#]*)(?:[:]([^/?#]*))?(/[^?#]*)?((?:[?](?:[^#]*))?)((?:#.*)?)$|', $res, $reg)
Source file: http://framework.zend.com/svn/framework/standard/trunk/library/Zend/OpenId.php
Line 162, 409.

I try to upgrade, downgrade php from 5.3.5 to 5.3.14 but it can not help.
Could you please help me fix this?
Thank you.
 
Last edited by a moderator:

webizen

Well-Known Member
#6
run from command line 'php -i' (look for Configure Command line) to get Apache php compile option and use the same options in LSWS php compile
 

dihuta

Well-Known Member
#7
I try it, try with different php versions,

'--with-config-file-path=/usr/local/etc/php5/cgi' '--with-curl=/usr/local/lib' '--with-gd' '--with-gettext' '--with-jpeg-dir=/usr/local/lib' '--with-freetype-dir=/usr/local/lib' '--with-kerberos' '--with-openssl' '--with-mcrypt' '--with-mhash' '--with-mysql=/usr' '--with-mysqli=/usr/bin/mysql_config' '--with-pcre-regex=/usr/local' '--with-pdo-mysql=/usr' '--with-pear' '--with-png-dir=/usr/local/lib' '--with-zlib' '--with-zlib-dir=/usr/local/lib' '--enable-zip' '--enable-gd-native-ttf' '--with-iconv=/usr/local' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-mbstring'

But that code still have error. Sample test which has error:

PHP:
<?php

preg_match('|^([^:]+)://([^:@]*(?:[:][^@]*)?@)?([^/:@?#]*)(?:[:]([^/?#]*))?(/[^?]*)?((?:[?](?:[^#]*))?(?:#.*)?)$|', 'asdf');

?>

http://dev.vimobi.com/test.php
 

webizen

Well-Known Member
#8
Here is the one I have. PHP 5.3.6

Configure Commands:
'./configure' '--prefix=/usr/local/opt/lsws/lsphp5' '--with-libdir=lib64' '--with-mysqli=mysqlnd' '--with-mysql' '--enable-ftp' '--with-openssl' '--enable-pdo' '--with-pdo-mysql' '--with-zlib' '--with-gd' '--enable-shmop' '--enable-track-vars' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-magic-quotes' '--enable-mbstring' '--with-iconv' '--with-curl' '--with-mcrypt' '--with-litespeed'
test code
Code:
<?php
$subject = 'http://www.example.com/ext/url';
preg_match('|^([^:]+)://([^:@]*(?:[:][^@]*)?@)?([^/:@?#]*)(?:[:]([^/?#]*))?(/[^?]*)?((?:[?](?:[^#]*))?(?:#.*)?)$|', $subject, $matches);
print_r($matches);
?>
result
Array
(
[0] => http://www.example.com/ext/url
[1] => http
[2] =>
[3] => www.example.com
[4] =>
[5] => /ext/url
[6] =>
)
 
Top