Call to undefined function App\Jobs\curl_init() in Laravel job, using DO LAMP droplet

November 6, 2019 201 views
PHP Frameworks LAMP Stack

I am using DO LAMP droplet to run a Laravel application, inside the application I have a job that require to run curl_init(), however it throws fatal error.

Call to undefined function App\Jobs\curl_init()

I have run

apt-get install php7.2-curl

and

service apache2 restart

what else I can do to enable it?

1 comment
  • Finally I found out what happened, I did install curl but I forgot to run artisan queue:restart… so my old task are running in old code so it didn’t work.

    php artisan queue:restart
    

    Thanks for help @KDSys

1 Answer

Hi @miyagichan,

I did experience the same issue a little while ago. Please make sure curl have actually been installed by doing

php -m | grep curl

If it hasn’t, check the PHP version, it’s possible you are installing it for 7.2 but the default version is something else

php -v

Regards,
KDSys

  • Hi @KDSys ,

    Thanks for your reply, but it seems my problem is something else. I ran your command and curl did installed and I can see it in phpinfo too.

    # php -m | grep curl
    curl
    # php -v
    PHP 7.2.24-0ubuntu0.18.04.1 (cli) (built: Oct 28 2019 12:07:07) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
        with Zend OPcache v7.2.24-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
    
Have another answer? Share your knowledge.