Can I open a dll extension without entering php.ini?

Asked

Viewed 199 times

3

I need to use the php_openssl.dll, but I don’t have access to php.ini, the server is foreign and also the support is difficult to access.

extension=php_openssl.dll

Is there any way to use it without getting into php.ini?

  • Do you know you can accept answers? See tour. You can accept an answer per question you asked. You can even accept your answer if it was the one that helped you best.

2 answers

3

Command line:

The parameter -d is used to set values in the file .ini:

php -dextension=php_openssl.dll

Running time:

This function has been removed since version 5.3

To load the extension at runtime, use the function dl:

<?php

if (!extension_loaded('openssl')) {
    if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
        dl('php_openssl.dll');
    } else {
        dl('openssl.so');
    }
}
  • It is possible to put in a file . php? <? php -dextension=php_openssl.dll ?>

  • I edited the answer. @Felipejorge

  • @lucio-Rubens, according to the PHP website the function dl() was removed in PHP 5.3 (see: http://php.net/manual/en/function.dl.php) =/

  • I added the info. Thanks for the signage! @Mateusdemboski

  • This information is very useful but the version of my PHP is 5.3.29.

3

Assuming you are using apache and you are allowed to do so, it is possible to use a file . htaccess with the following content:

#verifica se o módulo do PHP 5 para o apache foi carregado
<IfModule mod_php5.c>
#define o caminho para sua pasta de extensões
php_xtension_dir /caminh/absoluto/para/sua/pasta/de/extencoes/
#carrega os modulos
php_extension mbstring.so
php_extension openssl.so
php_extension libcurl.so
</IfModule>
  • And how would I put this inside the php file?

  • Hello @Felipe-Jorge! This code does not go inside a PHP file but, like this in response, in a file .htaccess, which should be created preferably at the root of the project.

  • This file can have any name. For example dll.htaccess?

  • No, it needs to be named . htaccess

  • but it has no extension?

  • Because then, that name comes from linux, where the "." indicates that it is a hidden file, so it has no extension and, unless you change the apache settings, the file needs to be named ". htaccess"...

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.