I need to enable the mcrypt functions on my website, except I'm on a shared host (running linux) and obviously don't have access to the php.ini
file. There does seem to be options for installing PEAR modules but a search told me mcrypt wasn't available. Is there any way I can do this, short of begging technical support to help me?
Update: Looking around a bit more, it looks like I might be able to use the dl()
function to dynamically load a library at run time. Since I'm only using the mcrypt functions in one spot, I could probably get away with doing this since the performance hit (I assume there is a hit) should be minimal. The only problem now is how to get the libmcrypt.so
file?
Another update: I've downloaded the libmcrypt.tar.bz2 file from Sourceforge and run ./configure
, make
, and then copied the libmcrypt.so.4.4.8
file into my home directory (as libmcrypt.so
), but now I can't find where to put it so that the dl()
function will find it.
Installing a PHP extension on Windows. On Windows, you have two ways to load a PHP extension: either compile it into PHP, or load the DLL. Loading a pre-compiled extension is the easiest and preferred way. To load an extension, you need to have it available as a ".dll" file on your system. All the extensions are automatically ...
The PHP Extension Community Library (PECL) is a repository for PHP Extensions, providing a directory of all known extensions and hosting facilities for downloading and development of PHP extensions.
The syntax of the language was 'borrowed' from C, Java, and Perl, though some new features were added. PHP is supported by most of web servers and operating systems. PHP extensions are used for different purposes with only a few exceptions: Every function in PHP is included into one extension or another.
If the extension does not appear in phpinfo(), you should check your logs to learn where the problem comes from. If you are using PHP from the command line (CLI), the extension loading error can be read directly on screen.
The MCrypt Sourceforge page should have it
http://mcrypt.sourceforge.net/
To compile it just:
wget http://superb-east.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gz
tar -xzvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
sudo make install
EDIT:
Can you reference it with a direct path?
What have you tried?
Edit2: It seems that you can only load moduals from the extensions directory set in the php.ini and you cannot override extensions_dir with ini_set so you will either have to convince your host to install it or if they allow you to have your own php.ini (many do usually in [username]/php.ini) then you could set the extensions_dir in there and load the modual with that.
Really the best way is to tell your ISP to include mcrypt support. Even if you bundle your own PHP extension and load it with dl(), there is no guarantee it is going to work after a PHP upgrade, as PHP is sometimes very version-number picky.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With