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

Discussion in 'PHP' started by dihuta, Aug 8, 2012.

  1. dihuta

    dihuta Member

    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: Aug 15, 2012
  2. webizen

    webizen New Member

    make sure litespeed svr has the matching PHP built as other server.
  3. dihuta

    dihuta Member



    I try upgrade/downgrade all versions of PHP, same to others too, but it can not help, issue is still exist.
  4. webizen

    webizen New Member

    It is not just the PHP version but the compile options.
  5. dihuta

    dihuta Member

    Is there any advice on build option as I left other as default DirectAdmin built.
  6. webizen

    webizen New Member

    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
  7. dihuta

    dihuta Member

    I try it, try with different php versions,


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

    PHP:
    <?php

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

    ?>

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

    webizen New Member

    Here is the one I have. PHP 5.3.6

    Configure Commands:
    test code
    Code:
    <?php
    $subject = 'http://www.example.com/ext/url';
    preg_match('|^([^:]+)://([^:@]*(?:[:][^@]*)?@)?([^/:@?#]*)(?:[:]([^/?#]*))?(/[^?]*)?((?:[?](?:[^#]*))?(?:#.*)?)$|', $subject, $matches);
    print_r($matches);
    ?>
    
    result
  9. dihuta

    dihuta Member

    The error was fixed with your configure command.
    Thanks for your support.

Share This Page