PHP 5.3.20: undefined function hash() - php

I'm trying to install Magento on FreeBSD with PHP 5.3.20, but the install script fails with
Fatal error: Call to undefined function hash() in /var/www/.../magento/lib/Zend/Cache/Backend/File.php on line 894
As it's cleared in another StackOverflow question it requires PHP 5.1.2, so that's a different problem. I installed the php5-mhash extension from ports and added mhash.so and hash.so to the extensions.ini. Also, there is no --disable-hash in the configure command. And it's the same in CLI too.
Probably because open_basedir? Any ideas?

Try installing it from security and see if this will work for you.
cd /usr/ports/security/php5-hash
make install clean

Related

Error: Call to undefined method ComposerAutoloaderInit13c2409cfa32d1fa0c04493c0d85c93c::getLoader()

I transfer Laravel to VPS and get the following error:
Fatal error: Uncaught Error: Call to undefined method ComposerAutoloaderInit13c2409cfa32d1fa0c04493c0d85c93c::getLoader() in /var/www/site.ru/application/vendor/autoload.php on line 7
Error: Call to undefined method ComposerAutoloaderInit13c2409cfa32d1fa0c04493c0d85c93c::getLoader() in /var/www/site.ru/application/vendor/autoload.php on line 7
PHP 7.4
I do composer dump-autoload and still no changes
Please help!)
git clone ...
composer install
Don't work.
Remove vendor and
composer install
Don't work.
For my case, symfony server:start and php -S both get the undefined method errors. I've uopz installed for testing. Disable the extension, and the error goes.
You have to disable uopz extension and restart apache :
phpdismod uopz
systemctl reload apache2
1 - you need to update php to a newer version (php 7.4.3 or above)
2 - use the composer from the official site (it's better to download it as a file)
In my case, everything worked the first time. I have Linux Mint 20, php 7.4.3, Laravel 7
If you have Linux Mint 20, then to install php7.4.3 you need to change mirros in Software Sources. In my case, I disable the repository from ondrej/php and changed mirros. Next install php

Issues using PHP Trader Functions: Call to undefined function trader_ma()

I'm attempting to install the Trader extension on my mac. I believe the install was done correctly but can't seem to use them. Here is my feedback from terminal
sudo pecl install trader
pecl/trader is already installed and is the same as the released version 0.4.0
install failed
Based on that it shows that I have installed it. But here is what I get when trying to use one
Uncaught Error: Call to undefined function trader_cci()
Anybody have tips on a step I may have missed?
Thanks in advance!
Did you include the extension in your php.ini file? You will need to add the following line in the correct ini (depends on if you use it on the command line or via FPM) to tell PHP that it needs to load the installed extension
extension=trader.so

Call to undefined function Symfony\Polyfill\Mbstring\iconv_strlen()

My project works fine on localhost but not working online and this is the error:
Fatal error: Call to undefined function Symfony\Polyfill\Mbstring\iconv_strlen() in /home/stram/public_html/vendor/symfony/polyfill-mbstring/Mbstring.php on line 338
I googled it and I found that I need to install the PHP extension iconv. The problem that I'm using a VPS and when I went to the list of available PHP extensions I didn't found this extension !
Thnx in advance.
Symfony provides an iconv-polyfill for cases like that. Just add it as requirement to your project, and you should be fine:
composer require symfony/polyfill-iconv
It may also happen that you are using an outdated version of PHP, or one that was compiled without iconv.
To check that, run php --ri iconv with any SSH software, like Putty, etc.
If it shows Extension 'iconv' not present., your problem is in PHP. Then you have a few options:
Run php -v to check your PHP version, and update it if necessary
Or compile PHP again with iconv
Or enable iconv on WHM/cPanel, if you use them
Or ask your hosting company for support
Here is a solution to your problem (command line is for CentOS) :
If you use WHM with the CentOS 7 operating system you will encounter errors like this when typing "composer" on the console:
Fatal error: Uncaught Error: Call to undefined function Symfony\Polyfill\Mbstring\iconv() in phar:///opt/cpanel/composer/bin/composer/vendor/symfony/polyfill-mbstring/Mbstring.php:661
Stack trace:
0 phar:///opt/cpanel/composer/bin/composer/vendor/symfony/polyfill-mbstring/bootstrap.php(48): Symfony\Polyfill\Mbstring\Mbstring::mb_strwidth('help', 'ASCII')
......
The solution is to install the iconv package using WHM:
Enter to your WHM then type "EasyApache 4" then click "EasyApache 4" and click "Customize". you can see in the picture
EasyApache 4
Select PHP Extensions, type "iconv" in the search and check the version of php that you will use to install the iconv package. see in the picture
PHP Extensions
Choose Review
Review
Click Provision
Provision
To ensure that the iconv package is installed you can use this command "php --ri iconv" if the results are like this in the picture. then the iconv package has succeeded. try typing the composer again so you don't get any more errors
php --ri iconv
Solved: If you are using Cpanel/WHM STACK then follow:
Go to WHM >> EasyApache4 >> Current Installed Packages >> customize
Now Select php extensions and search for iconv and debug install both of them and try to install again.. enjoy :)
I had the same error message when I installed Mbstring extension but did not restart Apache.
All that needed is to do
$ sudo /opt/local/etc/LaunchDaemons/org.macports.apache2/apache2.wrapper restart
Yeah, I have a long path here, but it is just for me. It is because I use MacPorts
To find your Apache location use
$ ps ax | grep apache
P.S.
I don't have iconv extension installed too. At list it is not listed when I call php info like so:
die(phpinfo());
BTW
it is really easy to install extension with MacPorts, For my PHP 5.6 I have done just:
$ sudo port install php56-mbstring

mcrypt and PHPUnit

I am using PHPUnit to test a project where mcrypt is heavily used. I have installed phpunit using this SO answer.
Whenever I try and run phpunit, I get the following error:
Fatal error: Call to undefined function mcrypt_create_iv() in
/files/file/using/mcrypt/thing.php on line 20
How can I fix this error? Do I have to install mcrpyt especially for PHPUnit?
You can either install MCrypt (which you should do anyway) or mark that specific test as one requiring MCrypt. The latter will cause the test to be skipped if you don't have MCrypt installed.

Can't install PHP extension with pecl because of perl "symbol lookup error"

I am trying to install the mongodb driver for PHP on my Amazon Linux server. I am currently running php 5.4 and have installed php54-devel. When I try to run "sudo pecl install mongo", I get the error:
/usr/bin/perl: symbol lookup error: /usr/local/lib64/perl5/auto/Data/Dumper/Dumper.so: undefined symbol: Perl_Istack_sp_ptr
I get the same error when I just run "cpan" so I think it's deeper than just the PHP extension.
I fixed the problem by deleting /usr/local/lib64/perl5/auto and running cpan again. I don't know much about perl, but from my research it seems that there must have been an incompatibility due to a previous upgrade.

Categories