David Colter

Active Member
Jun 30, 2016
40
10
8
USA
cPanel Access Level
Root Administrator
This question is asked to gain understanding and find the answer for 'clean-up' (aka organization). File this under Server Maintenance.

It seems sometimes that servers will become cluttered over time. Recently, I discovered that there are four versions of curl on the server. Thankfully, recent versions of curl and PHP are available (and actively updated) under EA-4.

Firstly, the server is running beautifully with EA-4. These recent versions are available via HTTP and cron - when cron is run with something like: /usr/local/bin/ea-php71.

When I recently checked whereis php and whereis curl, I saw this jumble ...

Code:
[email protected] [~]# whereis php
php: /usr/bin/php /etc/php.ini /usr/local/bin/php /usr/local/lib/php.ini,v /usr/local/lib/php.ini /usr/local/lib/php

[email protected] [~]# whereis curl
curl: /usr/bin/curl /usr/local/bin/curl /opt/curlssl/bin/curl /usr/share/man/man1/curl.1.gz
and when I followed some of these, the output was:

Code:
[email protected] [~]# /usr/bin/php -v
PHP 7.1.26 (cgi-fcgi) (built: Feb  5 2019 02:28:26)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

[email protected] [~]# /usr/local/bin/php -v
PHP 7.1.26 (cli) (built: Feb  5 2019 02:28:06) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

[email protected] [~]# /usr/local/lib/php -v
-bash: /usr/local/lib/php: is a directory
OK. PHP looks like it has been aliased to the updating EA4 version. That's good news.

But, when I checked on curl (which I use a lot), three older versions appeared.

Code:
[email protected] [~]# /usr/bin/curl -V
curl 7.48.0 (x86_64-redhat-linux-gnu) libcurl/7.48.0 OpenSSL/1.0.1e zlib/1.2.3 c-ares/1.10.0 libidn/1.18 libssh2/1.4.2
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets Metalink

[email protected] [~]# /usr/local/bin/curl -V
curl 7.50.3 (x86_64-pc-linux-gnu) libcurl/7.50.3 OpenSSL/1.0.2j zlib/1.2.8 libidn/1.18 nghttp2/1.15.0
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets

[email protected] [~]# /opt/curlssl/bin/curl -V
curl 7.24.0 (x86_64-unknown-linux-gnu) libcurl/7.24.0 OpenSSL/1.0.0 zlib/1.2.3 libidn/1.18
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz
When I checked /usr/bin, this was the (abbreviated) output

Code:
[email protected] [/usr/bin]# ls -l
...
  -rwxr-xr-x  1 root root    171888 Mar 29  2016 curl*
...
lrwxrwxrwx  1 root root            41 Feb  7 04:12 ea-php70 -> /opt/cpanel/ea-php70/root/usr/bin/php-cgi*
lrwxrwxrwx  1 root root            38 Feb  7 04:12 ea-php70-pear -> /opt/cpanel/ea-php70/root/usr/bin/pear*
lrwxrwxrwx  1 root root            38 Feb  7 04:12 ea-php70-pecl -> /opt/cpanel/ea-php70/root/usr/bin/pecl*
lrwxrwxrwx  1 root root            41 Feb  7 04:12 ea-php71 -> /opt/cpanel/ea-php71/root/usr/bin/php-cgi*
lrwxrwxrwx  1 root root            38 Feb  7 04:12 ea-php71-pear -> /opt/cpanel/ea-php71/root/usr/bin/pear*
lrwxrwxrwx  1 root root            38 Feb  7 04:12 ea-php71-pecl -> /opt/cpanel/ea-php71/root/usr/bin/pecl*
lrwxrwxrwx  1 root root            41 Feb  7 04:12 ea-php72 -> /opt/cpanel/ea-php72/root/usr/bin/php-cgi*
lrwxrwxrwx  1 root root            38 Feb  7 04:12 ea-php72-pear -> /opt/cpanel/ea-php72/root/usr/bin/pear*
lrwxrwxrwx  1 root root            38 Feb  7 04:12 ea-php72-pecl -> /opt/cpanel/ea-php72/root/usr/bin/pecl*
...
 -rwxr-xr-x  1 root root           937 Jan 29 21:06 php*
lrwxrwxrwx  1 root root            12 Apr 21  2016 php5-cgi -> /usr/bin/php*
lrwxrwxrwx  1 root root            18 Apr 21  2016 php5-cli -> /usr/local/bin/php*
lrwxrwxrwx  1 root root            18 Apr 21  2016 php-cli -> /usr/local/bin/php*
lrwxrwxrwx  1 root root            25 Apr 21  2016 php-config -> /usr/local/bin/php-config
(... omitting the same from /usr/local/bin for brevity)

This tells me that PHP (and, I think the curl it contains) has been aliased to /opt/cpanel/ea-php71/root/usr/bin/php-cgi*. Great! This is the PHP I want HTTP and cron to have available.

Questions:

1. Does the server need, the unaliased php*, php5-cgi, php5-cli, php-config and curl* contained in /usr/bin?

2. If the answer to 1 is No, is there another way to remove these (especially curl) than just deleting them?

3. The 4th curl version reports 7.63.0. Where is this curl version, and is it possible to alias the other whereis curl locations to that folder?

I am asking this question, because I want a clear understanding of which curl is being used in different circumstances. At this moment, if the server is accessed via command line, an old version of curl is there - waiting to answer.

I did clean up some php5.5 and php5.6 directories after upgrading to EA3 and then EA4, but it seems that remnants of the original system will always hang around, unless a clean up is performed.

David
 
Last edited:

David Colter

Active Member
Jun 30, 2016
40
10
8
USA
cPanel Access Level
Root Administrator
Is the first part of question 3 answered with:
Code:
[email protected] [/opt/cpanel/libcurl/bin]# /opt/cpanel/libcurl/bin/curl -V
curl 7.63.0 (x86_64-redhat-linux-gnu) libcurl/7.63.0 OpenSSL/1.0.2q zlib/1.2.3 brotli/1.0.2 libssh2/1.4.2 nghttp2/1.32.0
Release-Date: 2018-12-12
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,908
2,216
463
Hello @David Colter,

Deleting any of the PHP binaries or links to them is not advised due to their use with the ea-php-cli package.The following documents explain the purpose of the PHP binaries and their relation to the ea-php-cli package:

PHP Home - EasyApache 4 - cPanel Documentation
EasyApache 4 and the ea-php-cli Package - EasyApache 4 - cPanel Documentation

As far as cURL, the /usr/bin/curl location does not link to the ea-libcurl installation. It's a separate binary that comes from your OS:

Code:
# /usr/bin/curl -V
curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.36 zlib/1.2.7 libidn/1.28 libssh2/1.4.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz unix-sockets

# /opt/cpanel/libcurl/bin/curl -V
curl 7.64.0 (x86_64-redhat-linux-gnu) libcurl/7.64.0 OpenSSL/1.0.2q zlib/1.2.7 brotli/1.0.2 libssh2/1.4.3 nghttp2/1.32.0
Release-Date: 2019-02-06
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz brotli TLS-SRP HTTP2 UnixSockets HTTPS-proxy
The ea-libcurl RPM is utilized by default with PHP, whereas the OS-provided cURL is available for uses of your choosing outside of PHP.

Thank you.
 

David Colter

Active Member
Jun 30, 2016
40
10
8
USA
cPanel Access Level
Root Administrator
Thank you for your reply @cPanelMichael. I realize the initial post was lengthy and have learned from another thread that some cPanel functions may require an older version of php. However, your reply did not address the main purpose for posting the question.

I see your response regarding curl - protect the binary /opt/cpanel/libcurl/bin/curl and
... whereas the OS-provided cURL is available for uses of your choosing outside of PHP.
which leads me to understand 3 of the "old to very old" versions of curl can be safely removed. Do you agree?

The server has several older versions of PHP that are no longer needed, and since the server has been upgraded to EA4, it is desired that all accounts use the EA4 PHP versions 7.0, 7.1 or 7.2. The /usr/bin directory contains (among other binaries):
Code:
[email protected] [/usr/bin]# ls -l
...
 -rwxr-xr-x  1 root root           937 Jan 29 21:06 php*
lrwxrwxrwx  1 root root            12 Apr 21  2016 php5-cgi -> /usr/bin/php*
lrwxrwxrwx  1 root root            18 Apr 21  2016 php5-cli -> /usr/local/bin/php*
lrwxrwxrwx  1 root root            18 Apr 21  2016 php-cli -> /usr/local/bin/php*
lrwxrwxrwx  1 root root            25 Apr 21  2016 php-config -> /usr/local/bin/php-config
...
Are all of these necessary?

Short of wiping and reinstalling the server's OS, is there guidance for housekeeping (cleaning) on a cPanel provisioned server?

David
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,908
2,216
463
Hello @David Colter,

I think it's a better approach if we access the affected system via a support ticket before confirming it's safe to delete those binaries. If you open the ticket and post the ticket number here, I'll ensure this thread is linked to it.

Thank you.