Mcrypt not detected with Laravel installation - php

I am trying to make a simple Laravel app.
It seems to be installed correctly but once I run:
localhost/codehero-laravel/public/
(the example code)
it shows the message: "Mcrypt PHP extension required."
It is weird because when I run php -m it appears mcrypt.
Also, if I run "$php --info | grep mcrypt" it appears:
mcrypt
mcrypt support => enabled
mcrypt_filter support => enabled
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value
I tried everything I've fallen into, so please, can you help me?
Thank you very much!

Depending on your OS, you might have to create a symlink to mcrypt or move the .so file into another folder.
On Ubuntu:
$ sudo php5enmod mcrypt

Related

How to use external timezondb for PHP8.1 instead of internal Mac OS

After the updating homebrew, I have an issue with timezonedb. Brew updated "Olson" Timezone Database Version, but it shouldn't be a problem because of timezonedb extension. The problem is: php uses the internal timezone db instead of external one.
Extension installation process:
I installed this extension sudo pecl install timezonedb-2022.5, the version isn't the last, but I need it.
I added it to the .ini file from the conf.d catalog: extension=timezonedb.so
For now if I run the command: php -i | grep -i timezone I received
"Olson" Timezone Database Version => 2022.7
Timezone Database => internal
Default timezone => UTC
date.timezone => no value => no value
timezonedb
Alternative Timezone Database => enabled
Timezone Database Version => 2022.5
It means, that the interpreter sees the installed extension but it is still using the internal database. How can I fix it and use the external one?
php version is 8.1, but I tried with different ones. Php was installed using homebrew + symlink for the particular version (brew install php#8.1 && brew link php#8.1). Other extensions work properly
I fixed it by manually downgrading the minor version PHP to 8.1.7. The guide is below:
Download homebrew formulas (ruby config files) for PHP8.1.7 and icu4c dependency. It's the 72 version for php8.1.15 but must be 70 for php8.1.7 and it can't be installed automatically, because it tries to download the latest version.
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/f03637c77bc52f9fe497e23889db4563eb85299b/Formula/php.rb
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/f03637c77bc52f9fe497e23889db4563eb85299b/Formula/icu4c.rb
Reinstall icu4c using the command brew reinstall icu4c.rb. Check the Cellar: /usr/local/Cellar/icu4c/. You should have the 70.1 catalog.
Remove an old symlink rm /usr/local/opt/icu4c
Create a new one: ln -s /usr/local/Cellar/icu4c/70.1 /usr/local/opt/icu4c
Patch the ruby config for PHP. Remove depends_on "icu4c" to avoid downloading the last version of icu4c, save it
Reinstall PHP brew reinstall php.rb. If it's not default, symlink it.

Laravel 4.2 on PHP 7.2 with Mcrypt enabled still shows 'Mcrypt PHP extension required.' on browser

I am trying to run a Laravel application (4.2.22) locally with Laravel Homestead 8 that runs on php 7.2 with mcrypt.
I installed mcrypt and enabled it on both php.ini cli and apache2... I have tried everything but my browser still shows "Mcrypt PHP extension required." when I run the application... I was able to even install dependencies (composer install) without showing "mcrypt required"
php -i | grep "mcrypt" shows:
mcrypt
mcrypt support => enabled
mcrypt_filter support => enabled
php -m shows mcrypt
Is this something that might have to do with Laravel, Composer or some caching?
Checked phpinfo() and noticed the server was using etc/php/7.2/fpm/php.ini I added extension=mcrypt.so to the php.ini file and now it is working on the browser.

can not load oci8 -> Fatal error: Call to undefined function oci_connect()

I want to connect to my oracle database, but i have a problem with function oci_connect. i have tried to uncomment this:
extension=php_oci8.dll
but, still have an error :
Fatal error: Call to undefined function oci_connect() in C:\xampp\htdocs\testing\db.php on line 71
But, when i check in phpinfo(), oci8 still not loaded and i can not connect to my oracle database. i already restart my apache. How i fix this problem ? Canyou help me?
Thank you..
In Ubuntu 16.04, using PHP 5.6, with 64bit os, try this:
Install the packages:
sudo apt-get install php5.6-dev build-essential php-pear libaio1
Download the latest version of the packages from:
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
Search for these packages, according with the latest version:
oracle-instantclientXX.X-basic-XX.X.X.X.X-X.x86_64.rpm
oracle-instantclientXX.X-devel-XX.X.X.X.X-X.x86_64.rpm
Converting packages:
sudo apt-get install alien
sudo alien oracle-instantclientXX.X-basic-XX.X.X.X.X-X.x86_64.rpm
sudo alien oracle-instantclientXX.X-devel-XX.X.X.X.X-X.x86_64.rpm
Installing:
sudo dpkg -i oracle-instantclientXX.X-basic_XX.X.X.X.X-X_amd64.deb
sudo dpkg -i oracle-instantclientXX.X-devel_XX.X.X.X.X-X_amd64.deb
Installing oci8:
sudo pecl install oci8-2.0.12
*Build process completed successfully
Installing '/usr/lib/php/20131226/oci8.so'
install ok: channel://pecl.php.net/oci8-2.0.12
configuration option "php_ini" is not set to php.ini location
You should add "extension=oci8.so" to php.ini*
Add the extension to php:
sudo gedit /etc/php/5.6/apache2/php.ini
add the extension:
extension=oci8.so
Restart apache:
sudo service apache2 restart
That's it.
In php.ini ensure that you enable the correct OCI extension (11g), like this:
;extension=php_oci8.dll ; Use with Oracle 10gR2 Instant Client
extension=php_oci8_11g.dll ; Use with Oracle 11gR2 Instant Client
As long as you've got Oracle 11gR2 or greater client libraries correctly installed you should now be able to run:
C:\>php --ri oci8
And get the result:
oci8
OCI8 Support => enabled
Version => 1.4.10
Revision => $Id: b0984d94e17f7c099470cd0a9404259f2a59da04 $
Active Persistent Connections => 0
Active Connections => 0
Oracle Run-time Client Library Version => 11.2.0.3.0
Oracle Instant Client Version => 11.2
Temporary Lob support => enabled
Collections support => enabled
Directive => Local Value => Master Value
oci8.max_persistent => -1 => -1
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
oci8.default_prefetch => 100 => 100
oci8.old_oci_close_semantics => Off => Off
oci8.connection_class => no value => no value
oci8.events => Off => Off
To check your Oracle client is installed correctly (i.e., in your environment PATH variable) you can run:
C:\>where oci*
You should get a result like this:
C:\instantclient_11_2\oci.dll
C:\instantclient_11_2\oci.sym
C:\instantclient_11_2\ocijdbc11.dll
C:\instantclient_11_2\ocijdbc11.sym
C:\instantclient_11_2\ociw32.dll
C:\instantclient_11_2\ociw32.sym
Follow the offcial link for me Oracle
http://www.oracle.com/technetwork/articles/dsl/technote-php-instant-084410.html
Here is what worked with Xammp
1.uncomment extension=php_oci8_11g.dll ; Use with Oracle 11gR2 Instant Client if you are using 11g (in php.ini)
2.add AddHandler fcgid-script .php to httpd.conf
3.Download the FastCGI component mod_fcgid-2.3.6-win32-x86.zip from httpd.apache.org/download.cgi#mod_fcgid
4.Unzip it to the installed Apache 2.2 directory. The C:\xamp\apache\modules directory should now have mod_fcgid.so and mod_fcgid.pdb files.
5.Download the "Instant Client Package - Basic" for Windows from the OTN Instant Client page. Because PHP is 32 bit, use the 32 bit version of Instant Client.
Unzip the Instant Client files to C:\instantclient_11_2
Edit the Windows PATH environment setting and add C:\instantclient_11_2. For example, on Windows XP, follow Start -> Control Panel -> System -> Advanced -> Environment Variables and edit PATH in the System variables list.
Commonly you need to reboot Windows so the new environment is correctly set.
that worked for me all the best
Have a look at RO_engineer's answer of installing x86 files of Oracle insta client rather than x64 version. It resolved my issue, may be that can help you too.
https://stackoverflow.com/a/27177616/289587
Download Instant Client for Microsoft Windows (32-bit)

CentOS 5.10 can't enable php-openssl extension

I have installed CentOS 5.10 on my server and PHP 5.4.17, but the problem is that I can't enable php-openssl extension. By the command 'locate openssl' looks like the extension exists, so I tried to create the openssl.ini file in '/etc/php.d/' but there nothing happens.
Output by php -r "phpinfo();" | grep -i openssl:
OpenSSL support => disabled (install ext/openssl)
How I can enable that ext? I tried search in google, but found nothing useful. Sorry for my english. Thanks.
You enable it by making sure that the relevant files are installed on your server - you will need openSSL and the PHP openSSL extension (on a nearby RHEL 5.1 box, openSSL support is built in - it seems a little strange the Centos 5.10 should be any different).
If, as apparently in your case it is implemented as an external module, then you'll also need to amend your php.ini to load the extension. The convention with redhat is that optional extensions have their own file in /etc/php.d
Looking at the rpm list for Centos though, they don't seem to have openssl in a seperate extension. Could you have a non-standard binary?
Perhaps someone with Centos 5.10 can advise if it's linked at compile time (in which case you must have a modified binary)?

Microsoft ODBC driver conflict with libodbc.so.2 installing php-ldap

I have the Microsoft ODBC driver installed under Centos working fine with UnixODBC 2.3.0 as instructed. I am trying to install php-ldap and it will upgrade my php which is fine, except it fails on a dependency which is:
libodbc.so.2()(64bit) is needed by php-odbc-5.4.18-1.el6.remi.x86_64
I remember having trouble with this file which I had to hotlink to libodbc.so.1 to get php-pdo working. Now for the upgrade in PHP it's looking for that file and I guess maybe I have the 32 bit installed instead of the 64 bit. I tried copying over the 2.3.1 version and using the standard 2.2.4 but nothing seems to work.
It lives in
/usr/lib64/libodbc.so.2
I feel like if I get the wrong driver in there, PHP-PDO/MS ODBC will stop working just so php-ldap can work. My current PHP version is 5.4.16 and I'd rather just get the php-ldap for that but all the links seem dead - I just want to install it via RPM. Right now I'm using the remi repo to get the latest PHP version and would like an upgrade path without the libodbc causing issues.
ldd on the file:
linux-vdso.so.1 => (0x00007fff25fce000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f5754ac9000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f57548ac000)
libc.so.6 => /lib64/libc.so.6 (0x00007f5754518000)
/lib64/ld-linux-x86-64.so.2 (0x00007f5754f41000)
Look in /etc/odbcinst.ini the path to your driver needs to change
For Example (FreeTDS)
[FreeTDS]
Description=FreeTDS v0.91
Driver=/usr/lib64/libtdsodbc.so
...
What I did was manually install php_pdo by forcing the RPM's. It worked so I don't know what the issue really is... it's a difficult installation to perform with microsoft drivers && linux.

Categories