acrcloud / acrcloud_sdk_php

28 stars 18 forks source link

Call to undefined function ACRCloud\acrcloud_create_fingerprint_by_file() #8

Open King-abys opened 9 months ago

King-abys commented 9 months ago

I am getting this Uncaught Error: Call to undefined function ACRCloud\acrcloud_create_fingerprint_by_file() in C:\wamp64\www\Myproject\acrcloud_recognizer.php on line 298. I couldn't figure out what the issue is.

lucaspanik commented 9 months ago

I am getting this Uncaught Error: Call to undefined function ACRCloud\acrcloud_create_fingerprint_by_file() in C:\wamp64\www\Myproject\acrcloud_recognizer.php on line 298. I couldn't figure out what the issue is.

You may not have activated the PHP extension.


Steps to reproduce adding extension in PHP 8.2:

php_extension_dir=$(php -r "echo ini_get('extension_dir');") && \
    cd $php_extension_dir && \
    curl -L -o acrcloud_extr_tool.so https://github.com/acrcloud/acrcloud_sdk_php/raw/master/linux/x86-64/php82/modules/acrcloud_extr_tool.so
php -ini | grep 'Scan this dir for additional .ini files'
# Scan this dir for additional .ini files => /etc/php/8.2/cli/conf.d

If you have php-fpm:

php-fpm -ini | grep 'Scan this dir for additional .ini files'
# Scan this dir for additional .ini files => /etc/php/8.2/fpm/conf.d

Use the values above to replace below

echo "extension=acrcloud_extr_tool.so" > /etc/php/8.2/cli/conf.d/30-acrcloud.ini
echo "extension=acrcloud_extr_tool.so" > /etc/php/8.2/fpm/conf.d/30-acrcloud.ini

More information: https://github.com/acrcloud/acrcloud_sdk_php#install-modules