Home > Software design >  cURL not found in wordpress on AWS EC2 instance
cURL not found in wordpress on AWS EC2 instance

Time:01-24

On my Wordpress site the cURL command doesn't seem to work:

enter image description here

When I login into Wordpress, it clearly says cURL is not installed:

enter image description here

However, when I SSH into my EC2 instance, I shows that cURL is installed:

$ curl --version
curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.3.0 libpsl/0.19.1 ( libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Release-Date: 2018-01-24
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL

Because PHP is outdated, maybe it could be an PHP issue? When I check my PHP version, I shows I have the latest version installed:

$ php -v
PHP 8.2.1 (cli) (built: Jan 13 2023 10:42:21) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.1, Copyright (c), by Zend Technologies

But when I list all my PHP installs, I see that the top one corresponds with the one mentioned in Wordpress (7.3.33-9 ubuntu18.04.1 deb.sury.org 1):

$ dpkg --list | grep php
ii  libapache2-mod-php7.3            7.3.33-9 ubuntu18.04.1 deb.sury.org 1       amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  libapache2-mod-php8.2            8.2.1-2 ubuntu18.04.1 deb.sury.org 1        amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php                              2:8.2 93 ubuntu18.04.1 deb.sury.org 2       all          server-side, HTML-embedded scripting language (default)
ii  php-common                       2:93 ubuntu18.04.1 deb.sury.org 2           all          Common files for PHP packages
ii  php-curl                         2:8.2 93 ubuntu18.04.1 deb.sury.org 2       all          CURL module for PHP [default]
ii  php-fpm                          2:8.2 93 ubuntu18.04.1 deb.sury.org 2       all          server-side, HTML-embedded scripting language (FPM-CGI binary) (default)
ii  php-gd                           2:8.2 93 ubuntu18.04.1 deb.sury.org 2       all          GD module for PHP [default]
ii  php-mbstring                     2:8.2 93 ubuntu18.04.1 deb.sury.org 2       all          MBSTRING module for PHP [default]
rc  php7.0-curl                      7.0.33-0ubuntu0.16.04.2                     amd64        CURL module for PHP
ii  php7.2-cli                       7.2.34-37 ubuntu18.04.1 deb.sury.org 1      amd64        command-line interpreter for the PHP scripting language
ii  php7.2-common                    7.2.34-37 ubuntu18.04.1 deb.sury.org 1      amd64        documentation, examples and common module for PHP
ii  php7.2-curl                      7.2.34-37 ubuntu18.04.1 deb.sury.org 1      amd64        CURL module for PHP
ii  php7.2-fpm                       7.2.34-37 ubuntu18.04.1 deb.sury.org 1      amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php7.2-gd                        7.2.34-37 ubuntu18.04.1 deb.sury.org 1      amd64        GD module for PHP
ii  php7.2-json                      7.2.34-37 ubuntu18.04.1 deb.sury.org 1      amd64        JSON module for PHP
ii  php7.2-mbstring                  7.2.34-37 ubuntu18.04.1 deb.sury.org 1      amd64        MBSTRING module for PHP
ii  php7.2-mysql                     7.2.34-37 ubuntu18.04.1 deb.sury.org 1      amd64        MySQL module for PHP
ii  php7.2-opcache                   7.2.34-37 ubuntu18.04.1 deb.sury.org 1      amd64        Zend OpCache module for PHP
ii  php7.2-readline                  7.2.34-37 ubuntu18.04.1 deb.sury.org 1      amd64        readline module for PHP
ii  php7.3                           7.3.33-9 ubuntu18.04.1 deb.sury.org 1       all          server-side, HTML-embedded scripting language (metapackage)
ii  php7.3-cli                       7.3.33-9 ubuntu18.04.1 deb.sury.org 1       amd64        command-line interpreter for the PHP scripting language
ii  php7.3-common                    7.3.33-9 ubuntu18.04.1 deb.sury.org 1       amd64        documentation, examples and common module for PHP
ii  php7.3-json                      7.3.33-9 ubuntu18.04.1 deb.sury.org 1       amd64        JSON module for PHP
ii  php7.3-mysql                     7.3.33-9 ubuntu18.04.1 deb.sury.org 1       amd64        MySQL module for PHP
ii  php7.3-opcache                   7.3.33-9 ubuntu18.04.1 deb.sury.org 1       amd64        Zend OpCache module for PHP
ii  php7.3-readline                  7.3.33-9 ubuntu18.04.1 deb.sury.org 1       amd64        readline module for PHP
ii  php8.2                           8.2.1-2 ubuntu18.04.1 deb.sury.org 1        all          server-side, HTML-embedded scripting language (metapackage)
ii  php8.2-cli                       8.2.1-2 ubuntu18.04.1 deb.sury.org 1        amd64        command-line interpreter for the PHP scripting language
ii  php8.2-common                    8.2.1-2 ubuntu18.04.1 deb.sury.org 1        amd64        documentation, examples and common module for PHP
ii  php8.2-curl                      8.2.1-2 ubuntu18.04.1 deb.sury.org 1        amd64        CURL module for PHP
ii  php8.2-fpm                       8.2.1-2 ubuntu18.04.1 deb.sury.org 1        amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php8.2-gd                        8.2.1-2 ubuntu18.04.1 deb.sury.org 1        amd64        GD module for PHP
ii  php8.2-mbstring                  8.2.1-2 ubuntu18.04.1 deb.sury.org 1        amd64        MBSTRING module for PHP
ii  php8.2-opcache                   8.2.1-2 ubuntu18.04.1 deb.sury.org 1        amd64        Zend OpCache module for PHP
ii  php8.2-readline                  8.2.1-2 ubuntu18.04.1 deb.sury.org 1        amd64        readline module for PHP

I've also tried rebooting from the AWS EC2 dashboard.

CodePudding user response:

lel, you have php7.0-curl and php7.2-curl and php8.2-curl, but you run WordPress on the 1 php where you don't have curl: php7.3

sudo apt update;
sudo apt install php7.3-curl;
  • you should consider upgrading the php you run wordpress on though: PHP7.3 went EOL 6 desember 2021; by comparison, PHP8.2 is scheduled to go EOL 8 desember 2025.
  • it's very rare that you need any PHP5 version other than 5.6, and any PHP7 version other than 7.4, i suggest you install php7.4 and uninstall 7.0, 7.2, and 7.3.
  • Related