タグ: PHP

  • Ubuntu ServerのOSをアップグレードしたら、WordPressでエラー

    Ubuntu ServerのOSを、20.04から、22.04、24.04と同じ日にアップデートを実施した。実施のときにPHPのバージョンも変わったので、いろいろと対処した。Wordpressの表示もできるようになったのだが・・・管理画面にログインしようとしたら、下記のエラーが。

    エラー詳細
    ===============
    エラータイプ E_ERROR が /var/www/html/sitename/wp-content/themes/muum_tcd085/functions/theme-setup.php ファイルの 65 行目で発生しました。 エラーメッセージ: Uncaught Error: Call to undefined function simplexml_load_string() in /var/www/html/sitename/wp-content/themes/muum_tcd085/functions/theme-setup.php:65
    Stack trace:
    #0 /var/www/html/sitename/wp-content/themes/muum_tcd085/functions/update_notifier.php(15): get_tcd_update_notifier_xml()
    #1 /var/www/html/sitename/wp-includes/class-wp-hook.php(324): tcd_update_notifier_admin_menu()
    #2 /var/www/html/sitename/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
    #3 /var/www/html/sitename/wp-includes/plugin.php(517): WP_Hook->do_action()
    #4 /var/www/html/sitename/wp-admin/includes/menu.php(161): do_action()
    #5 /var/www/html/sitename/wp-admin/menu.php(423): require_once('...')
    #6 /var/www/html/sitename/wp-admin/admin.php(159): require('...')
    #7 /var/www/html/sitename/wp-admin/index.php(10): require_once('...')
    #8 {main}
      thrown

    この65行目をみると、

     $xml = simplexml_load_string( $cache_data );

    なので、XML関連ということがわかった。

    php8.3の状況を調べてみると、「php8.3-xml」がインストールされていない。なので、

    sudo apt install php8.3-xml

    で、インストールを行って、再起動。これで管理画面に入れるようになった。

    あと、Wordpressのサイトヘルスから足りていない推奨モジュールを表示して、aptでインストールした。

  • Pukiwiki 1.5.4へのバージョンアップをした

    PHPのバージョン変更に伴って、Pukiwiki 1.5.2 から、Pukiwiki 1.5.4にアップデートを行ったのでメモ。

    Pukiwiki 1.5.2 からPukiwiki 1.5.4へは、いきなりバージョンアップはできなくて、Pukiwiki 1.5.3へのバージョンアップ用のパッチを実行して、一度、Pukiwiki 1.5.3にしてから、Pukiwiki 1.5.4のパッチを当てて、バージョンアップした。

    パッチを当てるだけなので、段階アップデートだけど、つらくはなかった。一番大変だったのは、先にPHPのバージョンを上げてしまって、使っていたPukiwikiが白くなってしまい、バージョンがわからなくなったこと。先にバージョンを調べておくか、パッチを当てておけばよかった。

  • Nginx上のPHPのページにアクセスすると「File not found.」と表示される

    NginxにPHPを動作させるための設定をいれたのだが、アクセスすると、「File not found.」と表示されて、PHPの処理がされない。Nginxのエラーログを見てみると、下記の表示があった。

    FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream,

    Nginxの「/etc/nginx/sites-available/default」のPHPに関連する設定は、下記のように設定していた。

         # pass PHP scripts to FastCGI server 
            # 
            location ~ \.php$ { 
                        include snippets/fastcgi-php.conf; 
            # 
            #       # With php-fpm (or other unix sockets): 
                    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; 
            #       # With php-cgi (or other tcp sockets): 
            #       fastcgi_pass 127.0.0.1:9000; 
                    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name; 
            }

    上記を、次のように修正したところ、正常にPHPの処理が行われた。

         # pass PHP scripts to FastCGI server 
            # 
            location ~ \.php$ { 
                     root     /var/www/html; 
                     include snippets/fastcgi-php.conf; 
            # 
            #       # With php-fpm (or other unix sockets): 
                    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; 
            #       # With php-cgi (or other tcp sockets): 
            #       fastcgi_pass 127.0.0.1:9000; 
                    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name; 
                    include fastcgi_params; 
            }

    そもそものエラーが、ファイルの場所がわからないということなので、「root  path」でドキュメントルートを指定したことにより、正常に処理ができるようになった。Nginxの設定は、何回やっても難解でどこからしらで躓く。

  • WordPressのテンプレートのバージョンをあげたら、エラーになった

    WordPressで、独自インストールしていたテンプレートのバージョンをあげたところ、下記のエラーになった。

    Warning: file_exists(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /*********/wp-content/themes/simplicity2/functions.php on line 214
    

    PHPにOpenSSLのモジュールが入っていなかったのが原因。なので、インストールして、解消した。

    pkg search php73 | grep openssl
    pkg install php73-openssl-7.3.27
    apachectl restart
    
  • WordPress5.6にしたら、投稿画面がエラーになった

    WordPress 5.6にアップデートしたら、投稿画面の表示でエラーになった。ブラウザの画面には、エラーになったことしか表示されないので、詳しいエラー内容をコピーして確認した。

    確認したところ、Javascriptばかりがエラーになっていた。なので、ブラウザのキャッシュに残っているものが悪さをしている。ブラウザのキャッシュを削除して、再度Wordpressの管理画面にアクセスしたところ、正常に投稿画面が使えるようになった。このアップデート後の問題は、忘れたことに発生するので、少しびっくりする。

    エラー内容は下記。

    TypeError: Object(...) is not a function
        at WithSpokenMessages(WithInstanceId(WithFilters(n))) (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/components.min.js:7:280912)
        at we (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react-dom.min.js:84:293)
        at zj (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react-dom.min.js:226:496)
        at Th (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react-dom.min.js:152:223)
        at tj (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react-dom.min.js:152:152)
        at Te (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react-dom.min.js:146:151)
        at https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react-dom.min.js:61:68
        at unstable_runWithPriority (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react.min.js:26:340)
        at Da (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react-dom.min.js:60:280)
        at Pg (https://www.xenos.jp/xxxxxxx/wp-includes/js/dist/vendor/react-dom.min.js:61:14)
  • Magento 2.3.5で初期セットアップに繰り返したら、LogicExceptionエラーになった

    Magento 2.3.5で、ウェブ上から初期セットアップを行って、インストールの部分で躓く。いろいろと対処をしていく中で、何回も行っていたのだが、突然、成功していたインストールの部分(というか最初)で、エラーが出るようになってしまった。

    Unknown module in the requested list: 'Magento_CatalogRuleSampleData'
    [ERROR] exception 'LogicException' with message 'Unknown module in the requested list: 'Magento_BundleSampleData'' in setup\src\Magento\Setup\Model\Installer.php:403
    Stack trace:

    原因は、ブラウザのキャッシュだった。キャッシュをクリアしたところ、正常な動作(というか、もともとの別の場所で躓く)に戻った。なかなか、Magento2のインストールは大変。

  • Magento2.3.5のインストール後に管理ページが404エラーになる

    Ubuntuに、Magento 2.3.5をインストールした後に、管理ページにアクセスしたところ、ページが404エラーになった。他にも、いくつかのページが404エラーになった。

    原因は、Apacheのmod_rewriteの設定がMagentoのディレクトリで有効になっていないからだった。

    Apacheには、mod_rewriteを入れているし、読み込ませてもいるが、肝心のMagentoのディレクトリで使うように設定されていなかったのが原因。

    • .htaccess がMagentoのフォルダになかった
    • apache.confで、.htaccessによる設定の上書きができないようになっていた

    対処としては、後述の参考ページの設定をいれただけだ。

    まずMagentoのインストールディレクトリに下記の .htaccessを保存する。

    ###############################################
    ## overrides deployment configuration mode value
    ## use command bin/magento deploy:mode:set to switch modes
    #   SetEnv MAGE_MODE developer
    ############################################
    ## uncomment these lines for CGI mode
    ## make sure to specify the correct cgi php binary file name
    ## it might be /cgi-bin/php-cgi
    #    Action php5-cgi /cgi-bin/php5-cgi
    #    AddHandler php5-cgi .php
    ############################################
    ## GoDaddy specific options
    #   Options -MultiViews
    ## you might also need to add this line to php.ini
    ##     cgi.fix_pathinfo = 1
    ## if it still doesn't work, rename php.ini to php5.ini
    ############################################
    ## this line is specific for 1and1 hosting
        #AddType x-mapp-php5 .php
        #AddHandler x-mapp-php5 .php
    ############################################
    ## default index file
        DirectoryIndex index.php
    <IfModule mod_php5.c>
    ############################################
    ## adjust memory limit
        php_value memory_limit 768M
        php_value max_execution_time 18000
    ############################################
    ## disable automatic session start
    ## before autoload was initialized
        php_flag session.auto_start off
    ############################################
    ## enable resulting html compression
        #php_flag zlib.output_compression on
    ###########################################
    ## disable user agent verification to not break multiple image upload
        php_flag suhosin.session.cryptua off
    </IfModule>
    <IfModule mod_php7.c>
    ############################################
    ## adjust memory limit
        php_value memory_limit 768M
        php_value max_execution_time 18000
    ############################################
    ## disable automatic session start
    ## before autoload was initialized
        php_flag session.auto_start off
    ############################################
    ## enable resulting html compression
        #php_flag zlib.output_compression on
    ###########################################
    ## disable user agent verification to not break multiple image upload
        php_flag suhosin.session.cryptua off
    </IfModule>
    <IfModule mod_security.c>
    ###########################################
    ## disable POST processing to not break multiple image upload
        SecFilterEngine Off
        SecFilterScanPOST Off
    </IfModule>
    <IfModule mod_deflate.c>
    ############################################
    ## enable apache served files compression
    ## http://developer.yahoo.com/performance/rules.html#gzip
        # Insert filter on all content
        ###SetOutputFilter DEFLATE
        # Insert filter on selected content types only
        #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
        # Netscape 4.x has some problems...
        #BrowserMatch ^Mozilla/4 gzip-only-text/html
        # Netscape 4.06-4.08 have some more problems
        #BrowserMatch ^Mozilla/4\.0[678] no-gzip
        # MSIE masquerades as Netscape, but it is fine
        #BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
        # Don't compress images
        #SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
        # Make sure proxies don't deliver the wrong content
        #Header append Vary User-Agent env=!dont-vary
    </IfModule>
    <IfModule mod_ssl.c>
    ############################################
    ## make HTTPS env vars available for CGI mode
        SSLOptions StdEnvVars
    </IfModule>
    ############################################
    ## workaround for Apache 2.4.6 CentOS build when working via ProxyPassMatch with HHVM (or any other)
    ## Please, set it on virtual host configuration level
    ##    SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
    ############################################
    <IfModule mod_rewrite.c>
    ############################################
    ## enable rewrites
        Options +FollowSymLinks
        RewriteEngine on
    ############################################
    ## you can put here your magento root folder
    ## path relative to web root
        #RewriteBase /magento/
    ############################################
    ## workaround for HTTP authorization
    ## in CGI environment
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    ############################################
    ## TRACE and TRACK HTTP methods disabled to prevent XSS attacks
        RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
        RewriteRule .* - [L,R=405]
    ############################################
    ## redirect for mobile user agents
        #RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
        #RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
        #RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]
    ############################################
    ## never rewrite for existing files, directories and links
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-l
    ############################################
    ## rewrite everything else to index.php
        RewriteRule .* index.php [L]
    </IfModule>
    ############################################
    ## Prevent character encoding issues from server overrides
    ## If you still have problems, use the second line instead
        AddDefaultCharset Off
        #AddDefaultCharset UTF-8
    <IfModule mod_expires.c>
    ############################################
    ## Add default Expires header
    ## http://developer.yahoo.com/performance/rules.html#expires
        ExpiresDefault "access plus 1 year"
        ExpiresByType text/html A0
        ExpiresByType text/plain A0
    </IfModule>
    ###########################################
    ## Deny access to root files to hide sensitive application information
        RedirectMatch 404 /\.git
        <Files composer.json>
            order allow,deny
            deny from all
        </Files>
        <Files composer.lock>
            order allow,deny
            deny from all
        </Files>
        <Files .gitignore>
            order allow,deny
            deny from all
        </Files>
        <Files .htaccess>
            order allow,deny
            deny from all
        </Files>
        <Files .htaccess.sample>
            order allow,deny
            deny from all
        </Files>
        <Files .php_cs>
            order allow,deny
            deny from all
        </Files>
        <Files .travis.yml>
            order allow,deny
            deny from all
        </Files>
        <Files CHANGELOG.md>
            order allow,deny
            deny from all
        </Files>
        <Files CONTRIBUTING.md>
            order allow,deny
            deny from all
        </Files>
        <Files CONTRIBUTOR_LICENSE_AGREEMENT.html>
            order allow,deny
            deny from all
        </Files>
        <Files COPYING.txt>
            order allow,deny
            deny from all
        </Files>
        <Files Gruntfile.js>
            order allow,deny
            deny from all
        </Files>
        <Files LICENSE.txt>
            order allow,deny
            deny from all
        </Files>
        <Files LICENSE_AFL.txt>
            order allow,deny
            deny from all
        </Files>
        <Files nginx.conf.sample>
            order allow,deny
            deny from all
        </Files>
        <Files package.json>
            order allow,deny
            deny from all
        </Files>
        <Files php.ini.sample>
            order allow,deny
            deny from all
        </Files>
        <Files README.md>
            order allow,deny
            deny from all
        </Files>
    ################################
    ## If running in cluster environment, uncomment this
    ## http://developer.yahoo.com/performance/rules.html#etags
        #FileETag none
    ############################################
    ## Add custom headers
    <IfModule mod_headers.c>
        Header set X-Content-Type-Options "nosniff"
        Header set X-XSS-Protection "1; mode=block"
    </IfModule>

    次に、/etc/apache/の中のconfファイル(vhosts.confやapache.confなどから適切なものを書き換え)に下記を追加する。ディレクトリは、Magentoをインストールしたディレクトリに変える。

    <Directory /var/www/html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                allow from all
     </Directory>

    最後に、Apacheの再起動を行う。

    参考: https://qastack.jp/magento/89125/how-to-fix-magento-2-2-0-0-rc-admin-page-not-found-after-installation

  • PHPのバージョンアップしたら、Nginxが起動しなくなった

    Ubuntu 18.04で、PHPをPHP7.2からPHP7.4にアップデートしたところ、作業後にOSを再起動したら、Nginxが起動しなくなった。原因を調べて対処したので、メモを残す。

    Nginxのステータスを確認したところ。

    ubuntu@ip-10-0-0-122:/etc/nginx$ sudo service nginx status
    ● nginx.service - A high performance web server and a reverse proxy server
       Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
       Active: failed (Result: exit-code) since Wed 2020-10-14 22:35:23 PDT; 5s ago
         Docs: man:nginx(8)
      Process: 1296 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
    Oct 14 22:35:23 ip-10-0-0-122 systemd[1]: Starting A high performance web server and a reverse proxy server...
    Oct 14 22:35:23 ip-10-0-0-122 nginx[1296]: nginx: [emerg] "try_files" directive is duplicate in /etc/nginx/sites-enabled
    Oct 14 22:35:23 ip-10-0-0-122 nginx[1296]: nginx: configuration file /etc/nginx/nginx.conf test failed
    Oct 14 22:35:23 ip-10-0-0-122 systemd[1]: nginx.service: Control process exited, code=exited status=1
    Oct 14 22:35:23 ip-10-0-0-122 systemd[1]: nginx.service: Failed with result 'exit-code'.
    Oct 14 22:35:23 ip-10-0-0-122 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
    ubuntu@ip-10-0-0-122:/etc/nginx$
    

    PHP7.4にアップデートしたタイミングで、Apacheがインストールされて、これが自動起動しており、Nginxと、ポート80の使用が競合して、Nginxが落ちていた。apache2の自動起動を停止する。

    sudo systemctl disable apache2
    

    それでも、まだ、Nginxの起動でエラーになる。ログを見ると、コンフィグの問題のようなので、configtestを実施し、見事にエラーになる。

    ubuntu@ip-10-0-0-122:/etc/nginx/sites-available$ sudo service nginx configtest
     * Testing nginx configuration                                                                                   [fail]
    ubuntu@ip-10-0-0-122:/etc/nginx/sites-available$
    

    Nginxのコンフィグのdefaultで、php7.2-fpmの部分を、php7.4-fpmのsockに書き換え。

    その後、Nginxの起動を試すが失敗。Nginxのコンフィグチェックを行って、エラーになっている行を特定。

    sudo nginx -t
    nginx: [emerg] "try_files" directive is duplicate in /etc/nginx/sites-enabled/default:77
    nginx: configuration file /etc/nginx/nginx.conf test failed
    

    “try_files” がダブっているというので、場所を確認して、変更した。なぜ、急にエラーになったのか、はあるが、とりあえず、スルー。修正後は、Nginxが無事に起動した。

    最初のStatusのログをみると、最初から”try_files ”が問題って書いてあった。おちついて、見る必要あり。

  • UbuntuのPHPを7.2から、7.4にしてみた

    Ubuntu 18.04のPHPをPHP7.2からPHP7.4に上げた。PHPを使っているのは、Wordpress。そのメモ。でも、途中が消えてる気がする、というか消えてる。

    ubuntu@ip-10-0-0-122:~$ php -v
    PHP 7.2.24-0ubuntu0.18.04.7 (cli) (built: Oct  7 2020 15:24:25) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
        with Zend OPcache v7.2.24-0ubuntu0.18.04.7, Copyright (c) 1999-2018, by Zend Technologies
    ubuntu@ip-10-0-0-122:~$
    ubuntu@ip-10-0-0-122:~$ sudo apt install software-properties-common
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    software-properties-common is already the newest version (0.96.24.32.14).
    software-properties-common set to manually installed.
    The following packages were automatically installed and are no longer required:
      libdumbnet1 libnginx-mod-http-geoip libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail
      libnginx-mod-stream linux-aws-5.3-headers-5.3.0-1017 linux-aws-5.3-headers-5.3.0-1019
      linux-aws-5.3-headers-5.3.0-1023 linux-aws-5.3-headers-5.3.0-1028 linux-aws-5.3-headers-5.3.0-1030
      linux-aws-5.3-headers-5.3.0-1032 linux-aws-5.3-headers-5.3.0-1033 linux-aws-5.3-headers-5.3.0-1034
      linux-aws-5.3-headers-5.3.0-1035 linux-aws-headers-4.15.0-1041 linux-aws-headers-4.15.0-1043
      linux-aws-headers-4.15.0-1044 linux-aws-headers-4.15.0-1045 linux-aws-headers-4.15.0-1047
      linux-aws-headers-4.15.0-1048 linux-aws-headers-4.15.0-1050 linux-aws-headers-4.15.0-1052
      linux-aws-headers-4.15.0-1054 linux-aws-headers-4.15.0-1056 linux-aws-headers-4.15.0-1057
      linux-aws-headers-4.15.0-1058 linux-aws-headers-4.15.0-1060 linux-aws-headers-4.15.0-1063
      linux-aws-headers-4.15.0-1065 linux-headers-5.3.0-1035-aws linux-image-5.3.0-1035-aws linux-modules-5.3.0-1035-aws
      nginx-common nginx-core
    Use 'sudo apt autoremove' to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    ubuntu@ip-10-0-0-122:~$
    ubuntu@ip-10-0-0-122:~$
    ubuntu@ip-10-0-0-122:~$
    ubuntu@ip-10-0-0-122:~$ sudo add-apt-repository ppa:ondrej/php
     Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.
    Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa
    You can get more information about the packages at https://deb.sury.org
    IMPORTANT: The -backports is now required on older Ubuntu releases.
    BUGS&FEATURES: This PPA now has a issue tracker:
    https://deb.sury.org/#bug-reporting
    CAVEATS:
    1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
    2. If you are using apache2, you are advised to add ppa:ondrej/apache2
    3. If you are using nginx, you are advised to add ppa:ondrej/nginx-mainline
       or ppa:ondrej/nginx
    PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/
    WARNING: add-apt-repository is broken with non-UTF-8 locales, see
    https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:
    # LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
     More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
    Press [ENTER] to continue or Ctrl-c to cancel adding it.
    Hit:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic InRelease
    Get:2 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
    Get:3 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
    Get:4 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease [20.8 kB]
    Get:5 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
    Get:6 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 Packages [71.9 kB]
    Get:7 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main Translation-en [29.5 kB]
    Fetched 374 kB in 1s (398 kB/s)
    Reading package lists... Done
    ubuntu@ip-10-0-0-122:~$
    ubuntu@ip-10-0-0-122:~$
    ubuntu@ip-10-0-0-122:~$ sudo apt update
    Hit:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic InRelease
    Get:2 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
    Get:3 http://us-east-1.ec2.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
    Hit:4 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
    Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease
    Fetched 163 kB in 0s (399 kB/s)
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    20 packages can be upgraded. Run 'apt list --upgradable' to see them.
    ubuntu@ip-10-0-0-122:~$
    ubuntu@ip-10-0-0-122:~$ php -v
    PHP 7.4.11 (cli) (built: Oct 10 2020 19:44:50) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v3.4.0, Copyright (c) Zend Technologies
        with Zend OPcache v7.4.11, Copyright (c), by Zend Technologies
    ubuntu@ip-10-0-0-122:~$
    

    このあと、Nginxのコンフィグで、php7.2-fpmからphp7.4-fpmに指定を変更して、Nginxを再起動。

    WordPressにアクセスしたら、php7.4-mysqlが入っていないと言われ、使えず。aptでインストールする。

    sudo apt install php7.4-mysql

    そのあと、Wordpressのヘルスチェックを確認。gdもないというので、aptでインストール。

    sudo apt install php7.4-gd

    これでバージョンアップは終わり。

  • Moodleのgitリポジトリをクローンしたところ、拒否された

    Moodleをインストールするために、Gitリポジトリをクローンしようとしたしたところ、「git.moodle.org[0: 34.210.133.53]: errno=接続を拒否されました」と表示された。

    sudo git clone git://git.moodle.org/moodle.git
    Cloning into 'moodle'...
    fatal: unable to connect to git.moodle.org:
    git.moodle.org[0: 34.210.133.53]: errno=接続を拒否されました
    

    で、対処としては、github上のリポジトリから取得するようにした。これで、接続拒否のエラーは解消。

    sudo git clone https://github.com/moodle/moodle.git

    下記は、作業時のログ。

    zen@moodle:/opt$ sudo git clone git://git.moodle.org/moodle.git
    Cloning into 'moodle'...
    fatal: unable to connect to git.moodle.org:
    git.moodle.org[0: 34.210.133.53]: errno=接続を拒否されました
    
    zen@moodle:/opt$
    zen@moodle:/opt$
    zen@moodle:/opt$
    zen@moodle:/opt$
    zen@moodle:/opt$ ls
    zen@moodle:/opt$
    zen@moodle:/opt$
    zen@moodle:/opt$ git clone https://github.com/moodle/moodle.git
    fatal: could not create work tree dir 'moodle': 許可がありません
    zen@moodle:/opt$ sudo git clone https://github.com/moodle/moodle.git
    Cloning into 'moodle'...
    remote: Enumerating objects: 7, done.
    remote: Counting objects: 100% (7/7), done.
    remote: Compressing objects: 100% (7/7), done.
    remote: Total 1163958 (delta 0), reused 0 (delta 0), pack-reused 1163951
    Receiving objects: 100% (1163958/1163958), 536.89 MiB | 22.33 MiB/s, done.
    Resolving deltas: 100% (812431/812431), done.
    Updating files: 100% (21140/21140), done.
    zen@moodle:/opt$ ls
    moodle
    zen@moodle:/opt$
    
    
    zen@moodle:/opt/moodle$ sudo git branch -a
    * master
      remotes/origin/HEAD -> origin/master
      remotes/origin/MOODLE_13_STABLE
      remotes/origin/MOODLE_14_STABLE
      remotes/origin/MOODLE_15_STABLE
      remotes/origin/MOODLE_16_STABLE
      remotes/origin/MOODLE_17_STABLE
      remotes/origin/MOODLE_18_STABLE
      remotes/origin/MOODLE_19_STABLE
      remotes/origin/MOODLE_20_STABLE
      remotes/origin/MOODLE_21_STABLE
      remotes/origin/MOODLE_22_STABLE
      remotes/origin/MOODLE_23_STABLE
      remotes/origin/MOODLE_24_STABLE
      remotes/origin/MOODLE_25_STABLE
      remotes/origin/MOODLE_26_STABLE
      remotes/origin/MOODLE_27_STABLE
      remotes/origin/MOODLE_28_STABLE
      remotes/origin/MOODLE_29_STABLE
      remotes/origin/MOODLE_30_STABLE
      remotes/origin/MOODLE_31_STABLE
      remotes/origin/MOODLE_32_STABLE
      remotes/origin/MOODLE_33_STABLE
      remotes/origin/MOODLE_34_STABLE
      remotes/origin/MOODLE_35_STABLE
      remotes/origin/MOODLE_36_STABLE
      remotes/origin/MOODLE_37_STABLE
      remotes/origin/MOODLE_38_STABLE
      remotes/origin/master
    zen@moodle:/opt/moodle$
    zen@moodle:/opt/moodle$
    zen@moodle:/opt/moodle$ sudo git branch --track MOODLE_38_STABLE origin/MOODLE_38_STABLE
    Branch 'MOODLE_38_STABLE' set up to track remote branch 'MOODLE_38_STABLE' from 'origin'.
    zen@moodle:/opt/moodle$
    zen@moodle:/opt/moodle$
    zen@moodle:/opt/moodle$
    zen@moodle:/opt/moodle$ sudo git checkout MOODLE_38_STABLE
    Switched to branch 'MOODLE_38_STABLE'
    Your branch is up to date with 'origin/MOODLE_38_STABLE'.
    zen@moodle:/opt/moodle$