如何使用 PHP 7.4 Debian 10 Buster 启用 GD

问题描述

使用以下内容安装 PHP 7.4.5:

git clone https://github.com/kasparsd/PHP-7-debian.git
cd PHP-7-debian
./build.sh
sudo ./install.sh
sudo /etc/init.d/PHP7-fpm start
sudo systemctl enable PHP7-fpm
sudo systemctl is-enabled PHP7-fpm
sudo apt install PHP-gd

sudo PHPenmod gd
sudo systemctl restart Nginx
sudo /etc/init.d/PHP7-fpm restart
sudo Nginx -s reload

查找已安装的模块:

> PHP -m | grep gd
(no match)

PHP_info 配置

Configure Command   './configure' '--prefix=/usr/local/PHP7' '--enable-huge-code-pages' '--with-config-file-scan-dir=/usr/local/PHP7/etc/conf.d' '--enable-bcmath' '--with-bz2' '--enable-calendar' '--enable-intl' '--enable-exif' '--enable-dba' '--enable-ftp' '--with-gettext' '--with-gd' '--with-jpeg-dir' '--enable-mbstring' '--with-mhash' '--enable-MysqLnd' '--with-MysqLi' '--with-MysqL-sock=yes' '--with-pdo-MysqL' '--with-openssl' '--enable-pcntl' '--with-pspell' '--enable-shmop' '--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--with-zlib' '--enable-zip' '--without-libzip' '--with-readline' '--with-curl' '--enable-fpm' '--with-fpm-user=www-data' '--with-fpm-group=www-data'

PHP_info 提及 gd:

GD imaging: Rasmus Lerdorf,Stig Bakken,Jim Winstead,Jouni Ahto,Ilia Alshanetsky,Pierre-Alain Joye,marcus Boerger

PHP_info 中没有用于 GD 的部分。

尝试: 我已经看到在 PHP 7.4 中需要 --gd-enable 但它没有显示在配置中。 安装尝试:

sudo apt install PHP-gd
sudo PHPenmod gd
sudo systemctl restart PHP-fpm
sudo Nginx -s reload

但没有运气...

替代尝试: 使用 ondrej/PHP 存储库。

sudo add-apt-repository ppa:ondrej/PHP

但我得到一个例外:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py",line 917,in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py",line 865,in run
    self._target(*self._args,**self._kwargs)
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py",line 688,in addkey_func
    func(**kwargs)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py",line 386,in add_key
    return apsk.add_ppa_signing_key()
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py",line 273,in add_ppa_signing_key
    cleanup(tmp_keyring_dir)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py",line 234,in cleanup
    shutil.rmtree(tmp_keyring_dir)
  File "/usr/lib/python3.7/shutil.py",line 491,in rmtree
    _rmtree_safe_fd(fd,path,onerror)
  File "/usr/lib/python3.7/shutil.py",line 449,in _rmtree_safe_fd
    onerror(os.unlink,fullname,sys.exc_info())
  File "/usr/lib/python3.7/shutil.py",line 447,in _rmtree_safe_fd
    os.unlink(entry.name,dir_fd=topfd)
FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.extra'

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)