Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

marcellopato's avatar

Call to undefined function App\Http\Controllers\curl_init()

Hi guys! I have just deployed my Laravel app to aws ubuntu 18, php7.3, apache2, MySQL8, cURL 7.58.0 and don´t know why it is not working. The error is on this post title. It works just fine at my dev mac. I have done everything I found on Google and nothing seems to resolve this issue. Any helps, please?

0 likes
10 replies
tykus's avatar

Can you check that the cURL extension is loaded - phpinfo() in a route closure or php -m on server's CLI?

thureos's avatar

It looks more likely a syntax error, check where function is being called because that \curl_init() method without a class looks off

marcellopato's avatar

It works perfectly on my dev computer. Can´t be syntax error...

thureos's avatar

Run php -m | grep curl and paste the output please. You may have the CURL library installed but not the extension in PHP just as @tykus said.

thureos's avatar

sudo apt-get install php-curl or similar then systemctl restart apache or similar

if you have enough privilegies and check /etc/php<maybe a version number>/php.ini if you have that module enabled.

2 likes
marcellopato's avatar

Thanks, @thureos , It is working now. I realized that I was PHP 7.2 and PHP 7.3 installed at the same time. So I uninstalled both and reinstalled only 7.3

1 like
Cronix's avatar

It works perfectly on my dev computer. Can´t be syntax error...

That doesn't mean anything though, unless your php version is exactly the same on both dev and production and using the exact same php.ini in both places, and using the same OS/version in both places. Are they? Individual commands can be disabled via php.ini, so you can't just make an assumption like that unless environments are identical.

marcellopato's avatar

@cronix , you´re right. But I think this is not the problem though. Still working and I´ll let you guys know

marcellopato's avatar

All right. Now it is working. I realised that my server had PHP 7.2 and 7.3 at same time. Uninstall both and reinstalled 7.3. Now is working like a breeze! Thank You all!

Please or to participate in this conversation.