CENTOS
Tempat kejadian
Saya menginstal PHP di Centos Docker, ini DockerFile saya:
FROM centos:7.6.1810
LABEL maintainer="teran.a.joan@gmail.com"
RUN yum install httpd-2.4.6-88.el7.centos -y
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
RUN yum install php72w -y
ENTRYPOINT ["/usr/sbin/httpd", "-D", "FOREGROUND"]
Aplikasi mengembalikan kesalahan yang sama dengan json_decode dan json_encode
Resolusi
Instal PHP Common yang memiliki json_encode dan json_decode
yum install -y php72w-common-7.2.14-1.w7.x86_64
Bagaimana cara menemukan resolusi?
Saya memiliki File Docker lain yang membangun wadah untuk API dan memiliki perintah untuk menginstal klien php-mysql:
yum install php72w-mysql.x86_64 -y
Jika saya menggunakan gambar ini untuk memasang aplikasi, json_encode dan json_decode berfungsi !! Ok ..... Ketergantungan apa yang dimiliki ini?
[root@c023b46b720c etc]# yum install php72w-mysql.x86_64
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: mirror.gtdinternet.com
* epel: mirror.globo.com
* extras: linorg.usp.br
* updates: mirror.gtdinternet.com
* webtatic: us-east.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package php72w-mysql.x86_64 0:7.2.14-1.w7 will be installed
--> Processing Dependency: php72w-pdo(x86-64) for package: php72w-mysql-7.2.14-1.w7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: php72w-mysql-7.2.14-1.w7.x86_64
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: php72w-mysql-7.2.14-1.w7.x86_64
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.60-1.el7_5 will be installed
---> Package php72w-pdo.x86_64 0:7.2.14-1.w7 will be installed
--> Processing Dependency: php72w-common(x86-64) = 7.2.14-1.w7 for package: php72w-pdo-7.2.14-1.w7.x86_64
--> Running transaction check
---> Package php72w-common.x86_64 0:7.2.14-1.w7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================
Package Arch Version Repository Size
========================================================================================================
Installing:
php72w-mysql x86_64 7.2.14-1.w7 webtatic 82 k
Installing for dependencies:
mariadb-libs x86_64 1:5.5.60-1.el7_5 base 758 k
php72w-common x86_64 7.2.14-1.w7 webtatic 1.3 M
php72w-pdo x86_64 7.2.14-1.w7 webtatic 89 k
Transaction Summary
========================================================================================================
Install 1 Package (+3 Dependent packages)
Total download size: 2.2 M
Installed size: 17 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): mariadb-libs-5.5.60-1.el7_5.x86_64.rpm | 758 kB 00:00:00
(2/4): php72w-mysql-7.2.14-1.w7.x86_64.rpm | 82 kB 00:00:01
(3/4): php72w-pdo-7.2.14-1.w7.x86_64.rpm | 89 kB 00:00:01
(4/4): php72w-common-7.2.14-1.w7.x86_64.rpm | 1.3 MB 00:00:06
--------------------------------------------------------------------------------------------------------
Total 336 kB/s | 2.2 MB 00:00:06
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:mariadb-libs-5.5.60-1.el7_5.x86_64 1/4
Installing : php72w-common-7.2.14-1.w7.x86_64 2/4
Installing : php72w-pdo-7.2.14-1.w7.x86_64 3/4
Installing : php72w-mysql-7.2.14-1.w7.x86_64 4/4
Verifying : php72w-common-7.2.14-1.w7.x86_64 1/4
Verifying : 1:mariadb-libs-5.5.60-1.el7_5.x86_64 2/4
Verifying : php72w-pdo-7.2.14-1.w7.x86_64 3/4
Verifying : php72w-mysql-7.2.14-1.w7.x86_64 4/4
Installed:
php72w-mysql.x86_64 0:7.2.14-1.w7
Dependency Installed:
mariadb-libs.x86_64 1:5.5.60-1.el7_5 php72w-common.x86_64 0:7.2.14-1.w7
php72w-pdo.x86_64 0:7.2.14-1.w7
Complete!
Iya! Di dalam dependensi adalah paket umum. Saya memasangnya di wadah saya yang lain dan berfungsi! Setelah itu, saya menaruh arahan ke DockerFile, Git commit !! Tag Git !!!! Git Push !!!! Siap!
disable_functions
arahan ini untuk melihat apakahjson_decode
ada dalam daftar itu