Unable to upload picture using PHP

Comments

7 comments

  • Avatar
    Sqiish Dev

    I started recieving this error after i deployed my application to digitalocean.

    1
    Comment actions Permalink
  • Avatar
    Raya Straus

    Hi Anja,

    Can you please share with us the error your seeing?

    Thanks,

    Raya 

    0
    Comment actions Permalink
  • Avatar
    Anja in Matija

    The error:
    Fatal error: Uncaught Error: Call to undefined function Cloudinary\curl_init() in /var/www/html/cloudinary_php/src/Uploader.php:343 Stack trace: #0 /var/www/html/cloudinary_php/src/Uploader.php(88): Cloudinary\Uploader::call_api('upload', Array, Array, 'myimage.PNG') #1 /var/www/html/my-account.php(14): Cloudinary\Uploader::upload('myimage.PNG') #2 {main} thrown in /var/www/html/cloudinary_php/src/Uploader.php on line 343

    0
    Comment actions Permalink
  • Avatar
    Raya Straus

    Hi Anja,

    I see this issue was due to a setup error and was resolved internally. 

    Please let us know if you need anything else.

     

    0
    Comment actions Permalink
  • Avatar
    Sqiish Dev

    I was not experiencing this error before, but just started experiencing the same error.

    0
    Comment actions Permalink
  • Avatar
    Aleksandar Kostadinov

    Hi @Sqiish Dev,

    I saw you had created a direct ticket with us where one of my colleagues was looking into this for you. I see that you've updated that thread to let us know you were able to resolve the issue from your side.

    Are you able to share a few details about what you did on the server to resolve it? It would be useful in case another user runs into a similar issue.

    0
    Comment actions Permalink
  • Avatar
    Sqiish Dev

    Yeah I've been able to resolve the issue.

    So I found out that I was using two version's of php on my server PHP7.4 and PHP 8 i ran this command to check that,

     cd /etc/php

    So when i try to install curl on the server it was installing it for PHP 8. First i had to purge PHP 8 out of the server with this command

    sudo apt-get purge php8.*
    sudo apt-get autoclean
    sudo apt-get autoremove

    and i had earlier activated curl for PHP7.4 inside the php.ini file in the apache folder, to get the php.ini file you have to do this below

    cd /etc/php/7.4/apache2

    // when you are in the apache2 folder on the terminal run

    sudo nano php.ini //this will help you edit the php.ini file

    Search for curl in the file and activate it. You can do this by removing the semincolon in front of extension and you will have this below.

    extension = curl

    Now that curl is active on this php verison  simply use the debundled package for curl by running this command. Note that I'm using php 7.4 on the server so i will have to specify the version here.

    If you dont specify the version it will install curl module for the latest version of PHP which is PHP8

    $ sudo apt-get install php-curl // install's the curl module for the latest version of php

    sudo apt install php7.4-curl // install's curl module for PHP 7.4

    After installing curl for PHP 7.4, run this command to check the specific version of curl installed

    php -r 'echo curl_version()["version"] . "\n";'

     

    And YEAH it fixed the issue 🤗. I had to install curl for the specific version of php my server is using.

    0
    Comment actions Permalink

Please sign in to leave a comment.