Hhvm: undefined function session_start()

Created on 5 Jul 2019  路  6Comments  路  Source: facebook/hhvm

HHVM Version

HipHop VM 4.12.0 (rel)
Compiler: 1562000581_053014437
Repo schema: ae09177cea44bb26c3cc1f6d454eea4a349a5858

hh_client Version:

hackc-d8c447b436c6a3bb4ac7c14ef9d9be51d80af59e-4.12.0

Operating System and Version

Debian GNU/Linux 9 (stretch)

Standalone code, or other way to reproduce the problem

session_start();

Actual result

Fatal error: Uncaught Error: Call to undefined function session_start() in /home/mfurlend/test.hack:1
Stack trace:

0 {main}

Expected result

no output

Also, session is not included in the strings returned by get_loaded_extensions()

This is my first time messing around with hhvm/hack, so its very possible that this is a stupid question. I saw in the change log that "ext_session and the $_SESSION superglobal have been removed" - but what is the workaround then? Are sessions no longer supported?

Most helpful comment

All 6 comments

Sorry, I saw that you already read the removal notice...
Yes, $_SESSION and PHP sessions in general are nolonger supported. You can use your own scheme using many different persistence stores. @azjezz is a great person to talk to. His _as of now unfinished_ framework has great session support.

the session extension has been removed from hhvm, as the API wasn't something that is worth keeping, implementing your session could be a little bit hard, but you can take a look here to how its done : https://github.com/nuxed/framework/tree/rx/src/Nuxed/Http/Session

if you have any questions regarding implementing a session or using Nuxed\Http\Session, i would be happy to help :)

you can also compile the old session extension ( PHPs session extension ) and use it with HHVM, i can't guarantee that it would work as expected but its something worth trying :)

session ext : https://github.com/facebook/hhvm/tree/HHVM-4.3/hphp/runtime/ext/session

you can also compile the old session extension ( PHPs session extension ) and use it with HHVM, i can't guarantee that it would work as expected but its something worth trying :)

This is not a good use of time; the extension was removed as it depends on language features that are being entirely removed from the runtime. Even if it works /right now/, it's not going to work soon.

Thanks for the replies. I guess that sessions are simple enough to implement yourself, but I am a little surprised that this feature was removed as I was under the impression that hhvm strives to support all of the non-dynamic php features (e.g. not variable variables)

Thanks for the replies. I guess that sessions are simple enough to implement yourself, but I am a little surprised that this feature was removed as I was under the impression that hhvm strives to support all of the non-dynamic php features (e.g. not variable variables)

A had same issue. So I decided to port ext_session from older HHVM. (only memcached and file storage methods left + added Crypto lib) https://github.com/scharger/hhvm-ext_session

Was this page helpful?
0 / 5 - 0 ratings

Related issues

acrylic-origami picture acrylic-origami  路  4Comments

ahmadazimi picture ahmadazimi  路  7Comments

caioiglesias picture caioiglesias  路  6Comments

leetwiz picture leetwiz  路  7Comments

fredemmott picture fredemmott  路  3Comments