I encountered exactly this same problem but on AlmaLinux 8.
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
chdir: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
--2021-10-27 15:28:45-- https://pecl.php.net/get/mcrypt-1.0.1.tgz
Resolving pecl.php.net (pecl.php.net)... 104.236.228.160
Connecting to pecl.php.net (pecl.php.net)|104.236.228.160|:443... connected.
ERROR: The certificate of 'pecl.php.net' is not trusted.
ERROR: The certificate of 'pecl.php.net' was signed using an insecure algorithm.
tar: mcrypt-*: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
/usr/local/cwpsrv/htdocs/resources/conf/el8/php_switcher/external_modules/7.4/mcrypt.sh: line 7: cd: mcrypt-*/: No such file or directory
Cannot find config.m4.
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module
/usr/local/cwpsrv/htdocs/resources/conf/el8/php_switcher/external_modules/7.4/mcrypt.sh: line 9: ./configure: No such file or directory
make: *** No targets specified and no makefile found. Stop.
I was able to solve the problem by manually installing the PECL myself from the command line.
# pecl install mcrypt
We aren't using the multi PHP version switcher, so this installed the PECL for the one and only system version of PHP. If you're using the version switcher you might have to do the installation a bit differently.
Nonetheless the PECL install worked fine. I will just make a note of this so it can be done manually if we ever re-build PHP again and the process happens to fail again.
Also all the nonsense about this being a CentOS 8 issue seems to be nonsense - AlmaLinux is not CentOS.
It seems like there's a bug here which CWP should look into.
However part of the issue seems to be the download failing due to an invalid SSL certificate, I'm not sure why because the SSL certificate seems fine in my browser. In fact I can wget the same URL and I don't see any certificate problems.
[root@server ~]# wget -O /dev/null https://pecl.php.net/get/mcrypt-1.0.1.tgz
--2021-10-27 18:55:45-- https://pecl.php.net/get/mcrypt-1.0.1.tgz
Resolving pecl.php.net (pecl.php.net)... 104.236.228.160
Connecting to pecl.php.net (pecl.php.net)|104.236.228.160|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 33782 (33K) [application/octet-stream]
Saving to: ‘/dev/null’
100%[======================================>] 33,782 --.-K/s in 0.009s
2021-10-27 18:55:45 (3.54 MB/s) - ‘/dev/null’ saved [33782/33782]