そういうのがいいブログ

SIerで働く30代サラリーマンSEがインフラエンジニアに憧れてLinux・クラウド・AWSの勉強をするブログ

【CentOS8】PHP7.2からPHP7.4にアップデートする手順(後編)

※[PR]当ブログの記事の中にはプロモーションが含まれています。

・CentOS8でPHP7.2からPHP7.4にアップデートする手順を知りたい。

こういった疑問に答えます。

本記事の内容

  1. CentOS8でPHP7.2からPHP7.4にアップデートする手順

この記事を書いている私は、某SIerに勤務しながら、
WEB系エンジニア・インフラエンジニアに憧れて、プログラミングおよびインフラ技術の勉強をしています。

私が実機で試したコマンドや画像を載せて書いています。
記事の信頼性担保に繋がると思います。

前回の記事

前半の手順は以下の記事に書いています。

souiunogaii.hatenablog.com

CGI動作用のパッケージ「php-fpm」の設定

「/etc/php-fpm.d/」配下の設定ファイル「www.conf」の編集

/etc/php-fpm.d/www.confを修正します。

同じディレクトリに、PHP7.2のときのファイルがwww.conf.rpmsaveとして残っています。

00020  |; Unix user/group of processes                    ||00020  |; Unix user/group of processes                    
00021  |; Note: The user is mandatory. If the group is not||00021  |; Note: The user is mandatory. If the group is not
00022  |;       will be used.                             ||00022  |;       will be used.                             
00023  |; RPM: apache user chosen to provide access to the||00023  |; RPM: apache user chosen to provide access to the
00024 L|user = www                                        ||00024 R|user = apache                                     
00025  |; RPM: Keep a group allowed to write in log dir.  ||00025  |; RPM: Keep a group allowed to write in log dir.  
00026 L|group = www                                       ||00026 R|group = apache                                    
00044  |; Set permissions for unix socket, if one is used.||00044  |; Set permissions for unix socket, if one is used.
00045  |; permissions must be set in order to allow connec||00045  |; permissions must be set in order to allow connec
00046  |; Default Values: user and group are set as the ru||00046  |; Default Values: user and group are set as the ru
00047  |;                 mode is set to 0660             ||00047  |;                 mode is set to 0660             
00048 L|listen.owner = www                                ||00048 R|;listen.owner = nobody                            
00049 L|listen.group = www                                ||00049 R|;listen.group = nobody                            
00050 L|listen.mode = 0666                                ||00050 R|;listen.mode = 0660                               
00051  |                                                  ||00051  |                                                  
00052  |; When POSIX Access Control Lists are supported yo||00052  |; When POSIX Access Control Lists are supported yo
00053  |; these options, value is a comma separated list o||00053  |; these options, value is a comma separated list o
00054  |; When set, listen.owner and listen.group are igno||00054  |; When set, listen.owner and listen.group are igno
00055 L|;listen.acl_users = apache,nginx                  ||00055 R|listen.acl_users = apache,nginx                   
00056  |;listen.acl_groups =                              ||00056  |;listen.acl_groups =                              
00106  |; The number of child processes to be created when||00106  |; The number of child processes to be created when
00107  |; maximum number of child processes when pm is set||00107  |; maximum number of child processes when pm is set
00108  |; This value sets the limit on the number of simul||00108  |; This value sets the limit on the number of simul
00109  |; served. Equivalent to the ApacheMaxClients direc||00109  |; served. Equivalent to the ApacheMaxClients direc
00110  |; Equivalent to the PHP_FCGI_CHILDREN environment ||00110  |; Equivalent to the PHP_FCGI_CHILDREN environment 
00111  |; CGI. The below defaults are based on a server wi||00111  |; CGI. The below defaults are based on a server wi
00112  |; forget to tweak pm.* to fit your needs.         ||00112  |; forget to tweak pm.* to fit your needs.         
00113  |; Note: Used when pm is set to 'static', 'dynamic'||00113  |; Note: Used when pm is set to 'static', 'dynamic'
00114  |; Note: This value is mandatory.                  ||00114  |; Note: This value is mandatory.                  
00115 L|;pm.max_children = 50                             ||00115 R|pm.max_children = 50                              
00116 L|pm.max_children = 25                              ||       |                                                  
00117  |                                                  ||00116  |                                                  
00118  |; The number of child processes created on startup||00117  |; The number of child processes created on startup
00119  |; Note: Used only when pm is set to 'dynamic'     ||00118  |; Note: Used only when pm is set to 'dynamic'     
00120  |; Default Value: min_spare_servers + (max_spare_se||00119  |; Default Value: min_spare_servers + (max_spare_se
00121 L|;pm.start_servers = 5                             ||00120 R|pm.start_servers = 5                              
00122 L|pm.start_servers = 10                             ||       |                                                  
00123  |                                                  ||00121  |                                                  
00124  |; The desired minimum number of idle server proces||00122  |; The desired minimum number of idle server proces
00125  |; Note: Used only when pm is set to 'dynamic'     ||00123  |; Note: Used only when pm is set to 'dynamic'     
00126  |; Note: Mandatory when pm is set to 'dynamic'     ||00124  |; Note: Mandatory when pm is set to 'dynamic'     
00127 L|;pm.min_spare_servers = 5                         ||00125 R|pm.min_spare_servers = 5                          
00128 L|pm.min_spare_servers = 10                         ||       |                                                  
00129  |                                                  ||00126  |                                                  
00130  |; The desired maximum number of idle server proces||00127  |; The desired maximum number of idle server proces
00131  |; Note: Used only when pm is set to 'dynamic'     ||00128  |; Note: Used only when pm is set to 'dynamic'     
00132  |; Note: Mandatory when pm is set to 'dynamic'     ||00129  |; Note: Mandatory when pm is set to 'dynamic'     
00133 L|;pm.max_spare_servers = 35                        ||00130 R|pm.max_spare_servers = 35                         
00134 L|pm.max_spare_servers = 20                         ||       |                                                  
00141  |; The number of requests each child process should||00137  |; The number of requests each child process should
00142  |; This can be useful to work around memory leaks i||00138  |; This can be useful to work around memory leaks i
00143  |; endless request processing specify '0'. Equivale||00139  |; endless request processing specify '0'. Equivale
00144  |; Default Value: 0                                ||00140  |; Default Value: 0                                
00145  |;pm.max_requests = 500                            ||00141  |;pm.max_requests = 500                            
00146 L|pm.max_requests = 500                             ||       |                                                  

php-fpmの起動とステータス確認

systemctl start php-fpm
systemctl status php-fpm
[root@sv-neptune php-fpm.d]# systemctl start php-fpm
[root@sv-neptune php-fpm.d]# systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
   Active: active (running) since Wed 2020-09-16 08:38:36 JST; 2s ago
 Main PID: 180927 (php-fpm)
   Status: "Ready to handle connections"
    Tasks: 11 (limit: 11032)
   Memory: 38.3M
   CGroup: /system.slice/php-fpm.service
           tq180927 php-fpm: master process (/etc/php-fpm.conf)
           tq180928 php-fpm: pool www
           tq180929 php-fpm: pool www
           tq180930 php-fpm: pool www
           tq180931 php-fpm: pool www
           tq180932 php-fpm: pool www
           tq180933 php-fpm: pool www
           tq180934 php-fpm: pool www
           tq180935 php-fpm: pool www
           tq180936 php-fpm: pool www
           mq180937 php-fpm: pool www

 916 08:38:36 sv-neptune systemd[1]: Starting The PHP FastCGI Process Manager...
 916 08:38:36 sv-neptune systemd[1]: Started The PHP FastCGI Process Manager.

php-fpmが自動起動されるよう設定

systemctl enable php-fpm
systemctl is-enabled php-fpm
[root@sv-neptune php-fpm.d]# systemctl enable php-fpm
Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service.
[root@sv-neptune php-fpm.d]# systemctl is-enabled php-fpm
enabled

php.iniの修正

「/etc/」直下にある「php.ini」ファイルの編集

アップデート前のPHP7.2のときのファイルが同じディレクトリに、php.ini.rpmsaceというファイル名で残っています。

00370  |;;;;;;;;;;;;;;;;;                                 ||00370  |;;;;;;;;;;;;;;;;;                                 
00371  |; Miscellaneous ;                                 ||00371  |; Miscellaneous ;                                 
00372  |;;;;;;;;;;;;;;;;;                                 ||00372  |;;;;;;;;;;;;;;;;;                                 
00373  |                                                  ||00373  |                                                  
00374  |; Decides whether PHP may expose the fact that it ||00374  |; Decides whether PHP may expose the fact that it 
00375  |; (e.g. by adding its signature to the Web server ||00375  |; (e.g. by adding its signature to the Web server 
00376  |; threat in any way, but it makes it possible to d||00376  |; threat in any way, but it makes it possible to d
00377  |; on your server or not.                          ||00377  |; on your server or not.                          
00378  |; http://php.net/expose-php                       ||00378  |; http://php.net/expose-php                       
00379 L|;expose_php = On                                  ||00379 R|expose_php = On                                   
00380 L|expose_pho = Off                                  ||       |                                                  
00548  |; When PHP displays or logs an error, it has the c||00547  |; When PHP displays or logs an error, it has the c
00549  |; error message as HTML for easier reading. This d||00548  |; error message as HTML for easier reading. This d
00550  |; the error message is formatted as HTML or not.  ||00549  |; the error message is formatted as HTML or not.  
00551  |; Note: This directive is hardcoded to Off for the||00550  |; Note: This directive is hardcoded to Off for the
00552  |; http://php.net/html-errors                      ||00551  |; http://php.net/html-errors                      
00553 L|html_errors = On                                  ||00552 R|;html_errors = On                                 
00691  |; Maximum size of POST data that PHP will accept. ||00690  |; Maximum size of POST data that PHP will accept. 
00692  |; Its value may be 0 to disable the limit. It is i||00691  |; Its value may be 0 to disable the limit. It is i
00693  |; is disabled through enable_post_data_reading.   ||00692  |; is disabled through enable_post_data_reading.   
00694  |; http://php.net/post-max-size                    ||00693  |; http://php.net/post-max-size                    
00695 L|;post_max_size = 8M                               ||00694 R|post_max_size = 8M                                
00696 L|post_max_size = 20M                               ||       |                                                  
00759  |; Directory in which the loadable extensions (modu||00757  |; Directory in which the loadable extensions (modu
00760  |; http://php.net/extension-dir                    ||00758  |; http://php.net/extension-dir                    
00761  |;extension_dir = "./"                             ||00759  |;extension_dir = "./"                             
00762 L|extention_dir = "/usr/lib64/php/modules"          ||       |                                                  
00847  |; Maximum allowed size for uploaded files.        ||00844  |; Maximum allowed size for uploaded files.        
00848  |; http://php.net/upload-max-filesize              ||00845  |; http://php.net/upload-max-filesize              
00849 L|;upload_max_filesize = 2M                         ||00846 R|upload_max_filesize = 2M                          
00850 L|upload_max_filesize = 20M                         ||       |                                                  
00924  |[Date]                                            ||00920  |[Date]                                            
00925  |; Defines the default timezone used by the date fu||00921  |; Defines the default timezone used by the date fu
00926  |; http://php.net/date.timezone                    ||00922  |; http://php.net/date.timezone                    
00927  |;date.timezone =                                  ||00923  |;date.timezone =                                  
00928 L|date.timezone = "Asia/Tokyo"                      ||       |                                                  
01019  |[Pdo_mysql]                                       ||01014  |[Pdo_mysql]                                       
01020  |; Default socket name for local MySQL connects.  I||01015  |; Default socket name for local MySQL connects.  I
01021  |; MySQL defaults.                                 ||01016  |; MySQL defaults.                                 
01022 L|pdo_mysql.cache_sieze = 2000                      ||       |                                                  
01023  |pdo_mysql.default_socket=                         ||01017  |pdo_mysql.default_socket=                         
01044  |; Add X-PHP-Originating-Script: that will include ||01038  |; Add X-PHP-Originating-Script: that will include 
01045 L|;mail.add_x_header = Off                          ||01039 R|mail.add_x_header = Off                           
01046 L|mail.add_x_header = On                            ||       |                                                  
01113 L|mysqli.cache_size = 2000                          ||       |                                                  
01114 L|                                                  ||       |                                                  
01507  |[mbstring]                                        ||01498  |[mbstring]                                        
01508  |; language for internal character representation. ||01499  |; language for internal character representation. 
01509  |; This affects mb_send_mail() and mbstring.detect_||01500  |; This affects mb_send_mail() and mbstring.detect_
01510  |; http://php.net/mbstring.language                ||01501  |; http://php.net/mbstring.language                
01511 L|mbstring.language = Japanese                      ||01502 R|;mbstring.language = Japanese                     
01512  |                                                  ||01503  |                                                  
01513  |; Use of this INI entry is deprecated, use global ||01504  |; Use of this INI entry is deprecated, use global 
01514  |; internal/script encoding.                       ||01505  |; internal/script encoding.                       
01515  |; Some encoding cannot work as internal encoding. ||01506  |; Some encoding cannot work as internal encoding. 
01516  |; If empty, default_charset or internal_encoding o||01507  |; If empty, default_charset or internal_encoding o
01517  |; The precedence is: default_charset < internal_en||01508  |; The precedence is: default_charset < internal_en
01518 L|mbstring.internal_encoding = UTF-8                ||01509 R|;mbstring.internal_encoding =                     
01519  |                                                  ||01510  |                                                  
01520  |; Use of this INI entry is deprecated, use global ||01511  |; Use of this INI entry is deprecated, use global 
01521  |; http input encoding.                            ||01512  |; http input encoding.                            
01522  |; mbstring.encoding_translation = On is needed to ||01513  |; mbstring.encoding_translation = On is needed to 
01523  |; If empty, default_charset or input_encoding or m||01514  |; If empty, default_charset or input_encoding or m
01524  |; The precedence is: default_charset < input_encod||01515  |; The precedence is: default_charset < input_encod
01525  |; http://php.net/mbstring.http-input              ||01516  |; http://php.net/mbstring.http-input              
01526 L|mbstring.http_input = UTF-8                       ||01517 R|;mbstring.http_input =                            
01528  |; Use of this INI entry is deprecated, use global ||01519  |; Use of this INI entry is deprecated, use global 
01529  |; http output encoding.                           ||01520  |; http output encoding.                           
01530  |; mb_output_handler must be registered as output b||01521  |; mb_output_handler must be registered as output b
01531  |; If empty, default_charset or output_encoding or ||01522  |; If empty, default_charset or output_encoding or 
01532  |; The precedence is: default_charset < output_enco||01523  |; The precedence is: default_charset < output_enco
01533  |; To use an output encoding conversion, mbstring's||01524  |; To use an output encoding conversion, mbstring's
01534  |; otherwise output encoding conversion cannot be p||01525  |; otherwise output encoding conversion cannot be p
01535  |; http://php.net/mbstring.http-output             ||01526  |; http://php.net/mbstring.http-output             
01536 L|mbstring.http_output = pass                       ||01527 R|;mbstring.http_output =                           
01537  |                                                  ||01528  |                                                  
01538  |; enable automatic encoding translation according ||01529  |; enable automatic encoding translation according 
01539  |; mbstring.internal_encoding setting. Input chars ||01530  |; mbstring.internal_encoding setting. Input chars 
01540  |; converted to internal encoding by setting this t||01531  |; converted to internal encoding by setting this t
01541  |; Note: Do _not_ use automatic encoding translatio||01532  |; Note: Do _not_ use automatic encoding translatio
01542  |;       portable libs/applications.               ||01533  |;       portable libs/applications.               
01543  |; http://php.net/mbstring.encoding-translation    ||01534  |; http://php.net/mbstring.encoding-translation    
01544 L|mbstring.encoding_translation = On                ||01535 R|;mbstring.encoding_translation = Off              
01545  |                                                  ||01536  |                                                  
01546  |; automatic encoding detection order.             ||01537  |; automatic encoding detection order.             
01547  |; "auto" detect order is changed according to mbst||01538  |; "auto" detect order is changed according to mbst
01548  |; http://php.net/mbstring.detect-order            ||01539  |; http://php.net/mbstring.detect-order            
01549 L|mbstring.detect_order = auto                      ||01540 R|;mbstring.detect_order = auto                     
01550  |                                                  ||01541  |                                                  
01551  |; substitute_character used when character cannot ||01542  |; substitute_character used when character cannot 
01552  |; one from another                                ||01543  |; one from another                                
01553  |; http://php.net/mbstring.substitute-character    ||01544  |; http://php.net/mbstring.substitute-character    
01554 L|mbstring.substitute_character = none              ||01545 R|;mbstring.substitute_character = none             
01689 L|extension=oci8.so                                 ||       |                                                  

後で、Oracleへの接続もできるようにするために、``php.ini``の末尾に、
``extension=oci8.so`` を追記するのもここで行っておきました。

変更を反映させるためにphp-fpmの再起動

systemctl restart php-fpm
systemctl status php-fpm
[root@sv-neptune etc]# systemctl restart php-fpm
[root@sv-neptune etc]# systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2020-09-16 08:56:18 JST; 12s ago
 Main PID: 181018 (php-fpm)
   Status: "Processes active: 0, idle: 10, Requests: 0, slow: 0, Traffic: 0req/sec"
    Tasks: 11 (limit: 11032)
   Memory: 38.3M
   CGroup: /system.slice/php-fpm.service
           tq181018 php-fpm: master process (/etc/php-fpm.conf)
           tq181019 php-fpm: pool www
           tq181020 php-fpm: pool www
           tq181021 php-fpm: pool www
           tq181022 php-fpm: pool www
           tq181023 php-fpm: pool www
           tq181024 php-fpm: pool www
           tq181025 php-fpm: pool www
           tq181026 php-fpm: pool www
           tq181027 php-fpm: pool www
           mq181028 php-fpm: pool www

 916 08:56:18 sv-neptune systemd[1]: Stopped The PHP FastCGI Process Manager.
 916 08:56:18 sv-neptune systemd[1]: Starting The PHP FastCGI Process Manager...
 916 08:56:18 sv-neptune systemd[1]: Started The PHP FastCGI Process Manager.

httpdの再起動とステータス確認

systemctl restart httpd
systemctl status httpd
[root@sv-neptune etc]# systemctl restart httpd
[root@sv-neptune etc]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/httpd.service.d
           mqphp-fpm.conf
   Active: active (running) since Wed 2020-09-16 08:56:51 JST; 7s ago
     Docs: man:httpd.service(8)
 Main PID: 181042 (httpd)
   Status: "Started, listening on: port 443, port 80"
    Tasks: 213 (limit: 11032)
   Memory: 26.3M
   CGroup: /system.slice/httpd.service
           tq181042 /usr/sbin/httpd -DFOREGROUND
           tq181043 /usr/sbin/httpd -DFOREGROUND
           tq181044 /usr/sbin/httpd -DFOREGROUND
           tq181045 /usr/sbin/httpd -DFOREGROUND
           mq181046 /usr/sbin/httpd -DFOREGROUND

 916 08:56:51 sv-neptune systemd[1]: Starting The Apache HTTP Server...
 916 08:56:51 sv-neptune systemd[1]: Started The Apache HTTP Server.
 916 08:56:51 sv-neptune httpd[181042]: Server configured, listening on: port 443, port 80

OCI8のインストール

事前準備(Oracle Instant Clientのインストール)

Oracle19cのInstant Clientのインストールは、以下の記事の手順で済ませてあります。

souiunogaii.hatenablog.com

参考リンク

CentOSからOracleへ接続 https://mike-neko.github.io/blog/oracle-cent/ 

systemtap-sdt-develのインストール

dnf install systemtap-sdt-devel
[root@sv-neptune php]# dnf install systemtap-sdt-devel
メタデータの期限切れの最終確認: 1:02:43 時間前の 20200916171029秒 に実施しました。
依存関係が解決しました。
========================================================================================================================
 パッケージ                         アーキテクチャー      バージョン                     リポジトリー             サイズ
========================================================================================================================
インストール中:
 systemtap-sdt-devel                x86_64                4.2-6.el8                      AppStream                 81 k
依存関係のインストール中:
 python3-pyparsing                  noarch                2.1.10-7.el8                   BaseOS                   142 k

トランザクションの概要
========================================================================================================================
インストール  2 パッケージ

ダウンロードサイズの合計: 223 k
インストール済みのサイズ: 705 k
これでよろしいですか? [y/N]: y
パッケージのダウンロード:
(1/2): systemtap-sdt-devel-4.2-6.el8.x86_64.rpm                                         822 kB/s |  81 kB     00:00
(2/2): python3-pyparsing-2.1.10-7.el8.noarch.rpm                                        1.3 MB/s | 142 kB     00:00
------------------------------------------------------------------------------------------------------------------------
合計                                                                                    287 kB/s | 223 kB     00:00
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備              :                                                                                               1/1
  インストール中    : python3-pyparsing-2.1.10-7.el8.noarch                                                         1/2
  インストール中    : systemtap-sdt-devel-4.2-6.el8.x86_64                                                          2/2
  scriptlet の実行中: systemtap-sdt-devel-4.2-6.el8.x86_64                                                          2/2
  検証              : systemtap-sdt-devel-4.2-6.el8.x86_64                                                          1/2
  検証              : python3-pyparsing-2.1.10-7.el8.noarch                                                         2/2
Installed products updated.

インストール済み:
  python3-pyparsing-2.1.10-7.el8.noarch                       systemtap-sdt-devel-4.2-6.el8.x86_64

完了しました!

環境変数PHP_DTRACEをyesに設定

export PHP_DTRACE=yes
[root@sv-neptune php]# export PHP_DTRACE=yes

peclでoci8のインストール

pecl install oci8
[root@sv-neptune php]# pecl install oci8
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading oci8-2.2.0.tgz ...
Starting to download oci8-2.2.0.tgz (196,449 bytes)
.........................................done: 196,449 bytes
11 source files, building
running: phpize
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] :★★★空のまま[Enter]キー★★★
building in /var/tmp/pear-build-rootOQFn85/oci8-2.2.0
running: /var/tmp/oci8/configure --with-php-config=/usr/bin/php-config --with-oci8
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib64/php/modules
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... gawk
checking for Oracle Database OCI8 support... yes, shared
checking PHP version... 7.4.10, ok
checking OCI8 DTrace support... yes
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking sys/sdt.h usability... yes
checking sys/sdt.h presence... yes
checking for sys/sdt.h... yes
checking size of long int... 8
checking checking if we're on a 64-bit platform... yes
configure: WARNING: OCI8 extension: ORACLE_HOME is not set, looking for default Oracle Instant Client instead
checking Oracle Instant Client directory... /usr/lib/oracle/19.6/client64/lib
checking Oracle Instant Client SDK header directory... /usr/include/oracle/19.6/client64
checking Oracle Instant Client library version compatibility... 19.1
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
CFLAGS="-g -O2" dtrace -h -C -s /var/tmp/oci8/oci8_dtrace.d -o oci8_dtrace_gen.h.bak && /usr/bin/sed -e 's,PHPOCI_,DTRACE_,g' oci8_dtrace_gen.h.bak > oci8_dtrace_gen.h
/bin/sh /var/tmp/pear-build-rootOQFn85/oci8-2.2.0/libtool --mode=compile cc  -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/include -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/19.6/client64  -DHAVE_CONFIG_H  -g -O2   -c /var/tmp/oci8/oci8.c -o oci8.lo
libtool: compile:  cc -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/include -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/19.6/client64 -DHAVE_CONFIG_H -g -O2 -c /var/tmp/oci8/oci8.c  -fPIC -DPIC -o .libs/oci8.o
/bin/sh /var/tmp/pear-build-rootOQFn85/oci8-2.2.0/libtool --mode=compile cc  -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/include -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/19.6/client64  -DHAVE_CONFIG_H  -g -O2   -c /var/tmp/oci8/oci8_statement.c -o oci8_statement.lo
libtool: compile:  cc -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/include -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/19.6/client64 -DHAVE_CONFIG_H -g -O2 -c /var/tmp/oci8/oci8_statement.c  -fPIC -DPIC -o .libs/oci8_statement.o
echo "# Generated by Makefile for libtool" > oci8_dtrace.d.lo
if CFLAGS="-g -O2" dtrace -G -o ./.libs/oci8_dtrace.d.o -s /var/tmp/oci8/oci8_dtrace.d  ./.libs/oci8.o ./.libs/oci8_statement.o 2> /dev/null && test -f "./.libs/oci8_dtrace.d.o"; then \
  echo "pic_object='.libs/oci8_dtrace.d.o'" >> oci8_dtrace.d.lo ;\
else \
  echo "pic_object='none'" >> oci8_dtrace.d.lo ;\
fi
if CFLAGS="-g -O2" dtrace -G -o ./oci8_dtrace.d.o -s /var/tmp/oci8/oci8_dtrace.d ./oci8.o ./oci8_statement.o 2> /dev/null && test -f "./oci8_dtrace.d.o"; then \
  echo "non_pic_object='oci8_dtrace.d.o'" >> oci8_dtrace.d.lo ;\
else \
  echo "non_pic_object='none'" >> oci8_dtrace.d.lo ;\
fi
/bin/sh /var/tmp/pear-build-rootOQFn85/oci8-2.2.0/libtool --mode=compile cc  -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/include -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/19.6/client64  -DHAVE_CONFIG_H  -g -O2   -c /var/tmp/oci8/oci8_lob.c -o oci8_lob.lo
libtool: compile:  cc -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/include -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/19.6/client64 -DHAVE_CONFIG_H -g -O2 -c /var/tmp/oci8/oci8_lob.c  -fPIC -DPIC -o .libs/oci8_lob.o
/bin/sh /var/tmp/pear-build-rootOQFn85/oci8-2.2.0/libtool --mode=compile cc  -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/include -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/19.6/client64  -DHAVE_CONFIG_H  -g -O2   -c /var/tmp/oci8/oci8_collection.c -o oci8_collection.lo
libtool: compile:  cc -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/include -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/19.6/client64 -DHAVE_CONFIG_H -g -O2 -c /var/tmp/oci8/oci8_collection.c  -fPIC -DPIC -o .libs/oci8_collection.o
/bin/sh /var/tmp/pear-build-rootOQFn85/oci8-2.2.0/libtool --mode=compile cc  -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/include -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/19.6/client64  -DHAVE_CONFIG_H  -g -O2   -c /var/tmp/oci8/oci8_interface.c -o oci8_interface.lo
libtool: compile:  cc -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/include -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/19.6/client64 -DHAVE_CONFIG_H -g -O2 -c /var/tmp/oci8/oci8_interface.c  -fPIC -DPIC -o .libs/oci8_interface.o
/bin/sh /var/tmp/pear-build-rootOQFn85/oci8-2.2.0/libtool --mode=compile cc  -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/include -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/19.6/client64  -DHAVE_CONFIG_H  -g -O2   -c /var/tmp/oci8/oci8_failover.c -o oci8_failover.lo
libtool: compile:  cc -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/include -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/19.6/client64 -DHAVE_CONFIG_H -g -O2 -c /var/tmp/oci8/oci8_failover.c  -fPIC -DPIC -o .libs/oci8_failover.o
/bin/sh /var/tmp/pear-build-rootOQFn85/oci8-2.2.0/libtool --mode=link cc -DPHP_ATOM_INC -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/include -I/var/tmp/pear-build-rootOQFn85/oci8-2.2.0/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/oracle/19.6/client64  -DHAVE_CONFIG_H  -g -O2    -o oci8.la -export-dynamic -avoid-version -prefer-pic -module -rpath /var/tmp/pear-build-rootOQFn85/oci8-2.2.0/modules  ./oci8_dtrace.d.lo oci8.lo oci8_lob.lo oci8_statement.lo oci8_collection.lo oci8_interface.lo oci8_failover.lo -Wl,-rpath,/usr/lib/oracle/19.6/client64/lib -L/usr/lib/oracle/19.6/client64/lib -lclntsh
libtool: link: cc -shared  -fPIC -DPIC  ./.libs/oci8_dtrace.d.o .libs/oci8.o .libs/oci8_lob.o .libs/oci8_statement.o .libs/oci8_collection.o .libs/oci8_interface.o .libs/oci8_failover.o   -L/usr/lib/oracle/19.6/client64/lib -lclntsh  -g -O2 -Wl,-rpath -Wl,/usr/lib/oracle/19.6/client64/lib   -Wl,-soname -Wl,oci8.so -o .libs/oci8.so
libtool: link: ( cd ".libs" && rm -f "oci8.la" && ln -s "../oci8.la" "oci8.la" )
/bin/sh /var/tmp/pear-build-rootOQFn85/oci8-2.2.0/libtool --mode=install cp ./oci8.la /var/tmp/pear-build-rootOQFn85/oci8-2.2.0/modules
libtool: install: cp ./.libs/oci8.so /var/tmp/pear-build-rootOQFn85/oci8-2.2.0/modules/oci8.so
libtool: install: cp ./.libs/oci8.lai /var/tmp/pear-build-rootOQFn85/oci8-2.2.0/modules/oci8.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin" ldconfig -n /var/tmp/pear-build-rootOQFn85/oci8-2.2.0/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /var/tmp/pear-build-rootOQFn85/oci8-2.2.0/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/var/tmp/pear-build-rootOQFn85/install-oci8-2.2.0" install
Installing shared extensions:     /var/tmp/pear-build-rootOQFn85/install-oci8-2.2.0/usr/lib64/php/modules/
running: find "/var/tmp/pear-build-rootOQFn85/install-oci8-2.2.0" | xargs ls -dils
17881702   0 drwxr-xr-x 3 root root     17  916 18:14 /var/tmp/pear-build-rootOQFn85/install-oci8-2.2.0
 8914244   0 drwxr-xr-x 3 root root     19  916 18:14 /var/tmp/pear-build-rootOQFn85/install-oci8-2.2.0/usr
17881704   0 drwxr-xr-x 3 root root     17  916 18:14 /var/tmp/pear-build-rootOQFn85/install-oci8-2.2.0/usr/lib64
25556346   0 drwxr-xr-x 3 root root     21  916 18:14 /var/tmp/pear-build-rootOQFn85/install-oci8-2.2.0/usr/lib64/php
  839256   0 drwxr-xr-x 2 root root     21  916 18:14 /var/tmp/pear-build-rootOQFn85/install-oci8-2.2.0/usr/lib64/php/modules
  839257 896 -rwxr-xr-x 1 root root 917408  916 18:14 /var/tmp/pear-build-rootOQFn85/install-oci8-2.2.0/usr/lib64/php/modules/oci8.so

Build process completed successfully
Installing '/usr/lib64/php/modules/oci8.so'
install ok: channel://pecl.php.net/oci8-2.2.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=oci8.so" to php.ini

再起動

設定変更後の再起動

reboot

Oracle接続テスト用ページを作ってテスト

<?php
  $con = oci_connect('●●●ユーザー名','●●●パスワード','●●●データベース名');
  
  $sql = "select to_char(sysdate,'YYYY-MM-DD HH24:MI:SS') from dual";
  echo 'SQL = ' . $sql . '<br>';
  $stmt = oci_parse($con, $sql);
  $rslt = oci_execute($stmt);
  $row = oci_fetch_row($stmt);
  echo '結果 = ' . $row[0];
  oci_close($con);
?>