Need to call openssl_pkey_free after request finished
up vote
0
down vote
favorite
I am experimenting with openssl in PHP, and found openssl_pkey_get_private to load a key from file with a passphrase.
Do I need to use openssl_pkey_free to unload it before the request ends or will it be freed automatically by openssl when php is shutdown?
Normal variables will be freed automatically, but I am unsure about external resources like this.
I have built a helper function to load the key and cache the instance for multiple use for the current request, and since multiple components in my application will use the key during the request, I want to use the same instance.
Can I use register_shutdown_function to free the key if it's not freed automatically?
Thanks for your help.
php memory-management openssl php-openssl
add a comment |
up vote
0
down vote
favorite
I am experimenting with openssl in PHP, and found openssl_pkey_get_private to load a key from file with a passphrase.
Do I need to use openssl_pkey_free to unload it before the request ends or will it be freed automatically by openssl when php is shutdown?
Normal variables will be freed automatically, but I am unsure about external resources like this.
I have built a helper function to load the key and cache the instance for multiple use for the current request, and since multiple components in my application will use the key during the request, I want to use the same instance.
Can I use register_shutdown_function to free the key if it's not freed automatically?
Thanks for your help.
php memory-management openssl php-openssl
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am experimenting with openssl in PHP, and found openssl_pkey_get_private to load a key from file with a passphrase.
Do I need to use openssl_pkey_free to unload it before the request ends or will it be freed automatically by openssl when php is shutdown?
Normal variables will be freed automatically, but I am unsure about external resources like this.
I have built a helper function to load the key and cache the instance for multiple use for the current request, and since multiple components in my application will use the key during the request, I want to use the same instance.
Can I use register_shutdown_function to free the key if it's not freed automatically?
Thanks for your help.
php memory-management openssl php-openssl
I am experimenting with openssl in PHP, and found openssl_pkey_get_private to load a key from file with a passphrase.
Do I need to use openssl_pkey_free to unload it before the request ends or will it be freed automatically by openssl when php is shutdown?
Normal variables will be freed automatically, but I am unsure about external resources like this.
I have built a helper function to load the key and cache the instance for multiple use for the current request, and since multiple components in my application will use the key during the request, I want to use the same instance.
Can I use register_shutdown_function to free the key if it's not freed automatically?
Thanks for your help.
php memory-management openssl php-openssl
php memory-management openssl php-openssl
asked Nov 9 at 17:02
ulvesked
1309
1309
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53230266%2fneed-to-call-openssl-pkey-free-after-request-finished%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown