无法在 debian 10 下的 apache2 中启用 php5.6-gd
Unable to enable php5.6-gd in apache2 under a debian 10
我们的系统
我有这个s.o。
# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
apache 的实际版本
No, we cannot upgrade it
# apache2 -v
Server version: Apache/2.4.25 (Debian)
Server built: 2019-10-13T15:43:54
这是我们的php
Yes php 5.6 is old and deprecated. We cannot upgrade this old legacy app
# php -v
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/gd.so' - /usr/lib/php5/20131226/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 5.6.40-0+deb8u12 (cli) (built: Jun 28 2020 09:37:30)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
问题
如上所示
Unable to load dynamic library '/usr/lib/php5/20131226/gd.so' - /usr/lib/php5/20131226/gd.so:
但它已安装,并且对于 cli 和 apache2,the mods-avaiable\gd.ini
已在各自的 conf.d
.
中进行了 simlinked
# apt-get install php5.6-gd
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5.6-gd is already the newest version (5.6.40-52+0~20210701.54+debian10~1.gbpc0026e).
尽管如此,PHP是对的,没有/usr/lib/php5/20131226/gd.so
文件。
但是在通用 php
文件夹中有一个 gd.so
find / -name "gd.so"
/usr/lib/php/20131226/gd.so
问题
启用 php5.6-gd 的正确方法是什么?
实际上我这样做是为了解决问题,但我希望有更好的解决方案
cp /usr/lib/php/20131226/gd.so /usr/lib/php5/20131226/gd.so
cd /etc/php5/cli/conf.d
ln -s ../../mods-available/gd.ini 20-gd.ini
cd /etc/php5/apache/conf.d
ln -s ../../mods-available/gd.ini 20-gd.ini
systemctl restart apache2
有效
我还是不明白为什么有些扩展在 /usr/lib/php5
下,而这个却在 /usr/lib/php
下。
我们的系统
我有这个s.o。
# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
apache 的实际版本
No, we cannot upgrade it
# apache2 -v
Server version: Apache/2.4.25 (Debian)
Server built: 2019-10-13T15:43:54
这是我们的php
Yes php 5.6 is old and deprecated. We cannot upgrade this old legacy app
# php -v
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/gd.so' - /usr/lib/php5/20131226/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 5.6.40-0+deb8u12 (cli) (built: Jun 28 2020 09:37:30)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
问题
如上所示
Unable to load dynamic library '/usr/lib/php5/20131226/gd.so' - /usr/lib/php5/20131226/gd.so:
但它已安装,并且对于 cli 和 apache2,the mods-avaiable\gd.ini
已在各自的 conf.d
.
# apt-get install php5.6-gd
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5.6-gd is already the newest version (5.6.40-52+0~20210701.54+debian10~1.gbpc0026e).
尽管如此,PHP是对的,没有/usr/lib/php5/20131226/gd.so
文件。
但是在通用 php
文件夹中有一个 gd.so
find / -name "gd.so"
/usr/lib/php/20131226/gd.so
问题
启用 php5.6-gd 的正确方法是什么?
实际上我这样做是为了解决问题,但我希望有更好的解决方案
cp /usr/lib/php/20131226/gd.so /usr/lib/php5/20131226/gd.so
cd /etc/php5/cli/conf.d
ln -s ../../mods-available/gd.ini 20-gd.ini
cd /etc/php5/apache/conf.d
ln -s ../../mods-available/gd.ini 20-gd.ini
systemctl restart apache2
有效
我还是不明白为什么有些扩展在 /usr/lib/php5
下,而这个却在 /usr/lib/php
下。