2026-02-26
2026-01-08
2025-11-10
ソリトン数1のスキルミオン解を ChatGPT に聞いたら答えが怪しかったので自力で計算してみた件
\[ Q [g] \, = \, \frac{1}{24 \pi^2} \, \int d^3 x \, \ep_{ijk} \Tr ( g^{-1} \d_i g \, g^{-1} \d_j g \, g^{-1} \d_k g \, ) \tag{1} \]
で与えられる。ただし、$g$ は $SU(2)$ 群の要素であり、$g^\dag g = 1$, $\det g = 1$ を満たす。パウリ行列を用いると $g$ は
\[ g (x) \, = \, a (x) {\bf 1} + i b_i (x) \, \si_i \tag{2} \]
とパラメータ表示できる。ここで、$a$, $b_i$ $( i=1,2,3 )$ は $\vec{x}$ の関数であり条件式
\[ a^2 + b_i^2 \, = \, 1 \tag{3} \]
を満たす。これより、$g(x)$ は写像
\[ g(x) \, : \, \mathbb{R}^3 \, \longrightarrow \, S^3 \tag{4} \]
を与えることが分かる。
3次元球面 $S^3$ のステレオ射影を用いると $a$, $b_i$ は
\[ a = \frac{1- r^2}{1+ r^2} \, , ~~~~~ b_i = \frac{2 x_i}{1 + r^2} \tag{5} \]
とパラメータ表示できる。ただし、$r^2 = x_1^2 + x_2^2 + x_3^2$ である。ステレオ射影により $S^3$ 上の配位は $\mathbb{R}^3$ 上の配位と等価なのでこのパラメータ表示は巻き数1に対応する。すなわち、式(2), (5)を(1)に代入すると $Q = 1$ が得られる(はずである)。これは良く知られている結果であるが、係数 $1/ 24 \pi^2$ が本当に正しいのだろうか。実際に手を動かしてみるとこの計算は自明でない。そこで、困ったときの ChatGPT 頼みということで、
calculate winding number for skyrmions using stereographic parametrization
calculate $Q=1$ winding number for skyrmions using stereographic parametrization
などとして聞いてみた。が、どうも回答が統一しない。何度か試しても同じだったので結局自力で計算することにした。
求めたいのは式(1)なので先ず $I_i = g^{-1} \d_i g$ を計算しよう。
\[ I_i = g^{-1} \d_i g = ( a {\bf 1} - i b_\al \si_\al ) \d_i ( a {\bf 1} + i b_\bt \si_\bt ) \tag{6} \]
ただし、$a$ と $b_\bt$ の微分はそれぞれ
\[ \begin{eqnarray} \frac{\d}{\d x_i } a &=& - \frac{4 x_i}{(1+r^2)^2} \, = \, - \frac{2b_i}{1+r^2} \tag{7} \\ \frac{\d}{\d x_i } b_\bt &=& \frac{2}{1+r^2} \left( \del_{i \bt} - \frac{2 x_i x_\bt }{1+ r^2} \right) \, = \, \frac{2}{1+r^2} \del_{i \bt} - b_i b_\bt \tag{8} \end{eqnarray} \]
と書ける。よって、
\[ \begin{eqnarray} I_i &=& ( a {\bf 1} - i b_\al \si_\al ) \left( - \frac{2 b_i}{1+r^2} {\bf 1} + \frac{i 2}{1+r^2} \si_{i} - i b_i b_\bt \si_\bt \right) \nonumber \\ &=& \frac{ 2 b_i }{ 1+ r^2 } \left( -a + 1 - \frac{1+ r^2}{2 } b_\al b_\al \right) {\bf 1} + i \si_\al \frac{2}{1+r^2} \left( a \del_{\al i} - \frac{1+r^2}{2} a b_i b_\al + b_i b_\al + \ep_{i \al \bt } b_\bt \right)\nonumber \\ &=&i \si_\al \frac{2}{1+r^2} \left( a \del_{\al i} + x_i b_\al + \ep_{i \al \bt } b_\bt \right) \nonumber \\ & \equiv & i \si_\al A_{\al i} \tag{9} \end{eqnarray} \]
となる。ただし、$\si_\al \si_\bt = \del_{\al \bt } {\bf 1} + i \ep_{\al \bt \ga} \si_\ga$ を用いた。これより、
\[ \Tr ( I_i I_j I_k ) \, = \, - i \Tr ( \si_\al \si_\bt \si_\ga ) A_{\al i} A_{\bt j} A_{\ga k} \, = \, 2 \ep_{\al \bt \ga} A_{\al i} A_{\bt j} A_{\ga k} \tag{10} \]
が分かる。ただし、$ \Tr ( \si_\al \si_\bt \si_\ga ) = i 2\ep_{\al \bt \ga} $ を用いた。$\ep_{ijk} \Tr ( I_i I_j I_k )$ は
\[ \begin{eqnarray} && \ep_{ijk} \Tr ( I_i I_j I_k ) \nonumber \\ &=& 2 \left( \frac{2}{1 + r^2 } \right)^3 \ep_{ijk} \ep_{\al \bt \ga} ( a \del_{\al i} + x_i b_\al + \ep_{i \al l } b_l ) ( a \del_{\bt j} + x_j b_\bt + \ep_{j \bt m } b_m ) ( a \del_{\ga k} + x_k b_\ga + \ep_{k \ga n } b_n ) \tag{11} \end{eqnarray} \]
と表せる。展開するとゼロでない項は
\[\begin{eqnarray} \ep_{ijk} \ep_{\al \bt \ga} a^3 \del_{\al i } \del_{\bt j} \del_{\ga k } & = & \ep_{ijk} \ep_{ijk} a^3 \, = \, 6 a^3 \tag{12} \\ \ep_{ijk} \ep_{\al \bt \ga} a^2 x_k b_\ga \del_{\al i } \del_{\bt j} & = & \ep_{ijk} \ep_{ij\ga} a^2 x_k b_\ga \, = \, 2 \del_{k \ga} a^2 x_k b_\ga \, = \, 2 a^2 \vec{x} \cdot \vec{b} \tag{13} \\ \ep_{ijk} \ep_{\al \bt \ga} a b_m b_n \del_{\al i } \ep_{j \bt m} \ep_{k \ga n} & = & \ep_{ijk} \ep_{i \bt\ga} \ep_{j \bt m} \ep_{k \ga n} a b_m b_n \, = \, - \ep_{j \bt m} \ep_{\bt j n} a b_m b_n \, = \, 2 a \vec{b} \cdot \vec{b} \tag{14} \\ \ep_{ijk} \ep_{\al \bt \ga} x_i b_\al b_m b_n \ep_{j \bt m} \ep_{k \ga n} & = & \ep_{ijk} \ep_{j \bt m} \ep_{\al \bt\ga} \ep_{k \ga n} x_i b_\al b_m b_n \, = \, \ep_{\al \bt \ga} \ep_{\bt \ga n} x_i b_\al b_i b_n \, = \, 2 \vec{x} \cdot \vec{b} \, \vec{b} \cdot \vec{b} \tag{15} \end{eqnarray} \]
などから得られるので、まとめると
\[\begin{eqnarray} \ep_{ijk} \Tr ( I_i I_j I_k ) &=& 2 \left( \frac{2}{1 + r^2 } \right)^3 \left( 6 a^3 + 2 a^2 \vec{x} \cdot \vec{b} \times 3 + 2 a \vec{b} \cdot \vec{b} \times 3 + 2 \vec{x} \cdot \vec{b} \, \vec{b} \cdot \vec{b} \times 3 \right) \nonumber \\ &=& 12 \left( \frac{2}{1 + r^2 } \right)^3 \left[ a^2 \left( a+ \frac{2r^2}{1 + r^2 } \right) + \left(\frac{2}{1+r^2 } \right)^2 r^2 \left( a+ \frac{2r^2}{1 + r^2 } \right) \right] \nonumber \\ &=& 12 \left( \frac{2}{1 + r^2 } \right)^3 \tag{16} \end{eqnarray} \]
と表せる。ただし、式(5)から明らかなように
\[\begin{eqnarray} a+ \frac{2r^2}{1 + r^2 } &=& 1 \nonumber \\ a^2 + \left(\frac{2}{1+r^2 } \right)^2 r^2 &=& \left(\frac{1}{1+r^2 } \right)^2 \left[ (1 - r^2)^2 + 4 r^2 \right] \, = \, 1 \end{eqnarray} \]
が成り立つことに注意しよう。以上より、(2), (5)で定義される $g$ をソリトン数 $Q [g]$ に代入すると確かに
\[\begin{eqnarray} Q [g] &=& \frac{1}{24 \pi^2 } \int d^3 x \, \ep_{ijk} \Tr ( I_i I_j I_k ) \, = \, \frac{1}{24 \pi^2 } \int d^3 x \, 12 \left( \frac{2}{1 + r^2 } \right)^3 \nonumber \\ &=& \frac{16}{\pi } \int \frac{r^2}{(1+ r^2 )^3 } dr \, = \, 1 \tag{17} \end{eqnarray} \]
と求まる。ただし、積分測度を $d^3 x$ から $4 \pi r^2 dr$ へ変換し
\[ \int_0^\infty \frac{r^2}{(1+ r^2 )^3 } dr \, = \, \frac{\pi}{16} \]
を用いた。
2025-10-28
ソリトン数1のサイン-ゴルドン・ソリトンの tanh 解を ChatGPT に聞いたら即解決
サイン-ゴルドン方程式
\[ \left( \frac{\d^2}{\d t^2} - \frac{\d^2}{\d x^2} \right) \phi + \la \sin \phi \, = \, 0 ~~~ (\la > 0 ) \tag{1} \]
の静的な解は
\[ \phi \, = \, 4 \arctan \left( e^{ \sqrt{\la} x } \right) \tag{2} \]
で与えられる。$\phi$ の範囲を $[ 0 , 2 \pi ]$ に指定するとこれはソリトン数 $Q =1$ のソリトン解になる。これは良く知られている結果であり、以前にこちらでも解説した。しかし、このソリトン解を $\tanh$ で書き換える場合もある。$\tanh$ の範囲 $|\tanh x | < 1$ から $\pi + \pi \tanh ( a x) $ の形になることは想像できるが係数を決めるのは大変そう。おそらく $x=0$ での傾きを一致させて求めるのだろうけど微分めんどくさいなあとためらっていました。そこで、現代の利器 chatGPT に
approximate arctan(exp(a x)) by tanh(b x)
と聞いてみると、なんと25秒!で
\[ \arctan \left( e^{ a x } \right) \, \approx \, \frac{\pi}{4} \left( 1 + \tanh \frac{2 a}{ \pi} x \right) \tag{3} \]
と答えてくれました。今更ながら、いや~スゴイ。これからもお世話になります!
2025-09-03
関数のグラフ表示は GeoGebra が便利!
ブラウザですぐに表示してくれるのでとても便利!
こんなのがあるとは知りませんでした。だいぶ前からあったようです。関数グラフと言えば gnuplot だと思っていましたが、GeoGebra なら中学生でも使えるし解析関数の理解に役立つこと間違いなし。先生方も問題作成が楽になりますね。
2024-11-02
WinEdt 11 で index 作成
\usepackage{makeidx}
\makeindex
\printindex
で作成されるはずなのになぜか更新されません。WinShell で日本語の LaTeX を作成したときは索引も更新されていたはずなのに。LaTeX を走らせると idx ファイルは更新されるのだけど ind ファイルは古いままだったので色々試してみると、idx ファイル作成後にツールバーから
TeX --> Make Index
で ind ファイルが更新されました! そういえばそうだったか。完全に忘れていました。分かれば単純なことなのに1時間ぐらい Execution Modes などをいじって混乱してしまいました。今後は定期的にツールバーから make index しないとな。
2024-03-12
BCS理論の転移温度の計算に出てくる積分
前回のエントリーで出てきた積分
\[ \int_0^\infty \frac{\log x}{\cosh^2 x} dx = \log \frac{\pi}{4} - \ga \approx -0.81878 \]
ただし、$\ga$はオイラーの定数。これが分からなくて2、3日使ってしまいました。子供の小学校の保護者会に出席したときも気になってしまいメモする始末。結局、自力では無理だったので色々調べました。MathematicaのWebバージョンWolframAlphaが正しい数値結果を出してくれましたが、解析的に計算してくれないと納得いきません。Google Chromeで「integral from 0 to infinity log(x) sech^2 (x) dx」と検索を掛けると Math Stack Exchange がドンピシャのサイトを見つけてくれました! Microsoft Edgeではヒットしなかったので驚きました。解法を見て、これは自力では無理だなあと納得しました。双曲線関数の積分なんて忘れていました。学部の時にやったけど使う機会がないとダメですね。当時は公式集があれば何とかかなるだろうと思っていましたが、何ともならなかったです。双曲線関数の出てくる積分についてネットで調べてみたらインド人の学生向けにいろいろな積分が解説されていて興味深かったです。今では動画で複素積分の勉強ができるみたいですね。今後、積分に詰まったらまずChromeで検索かな。
2024-01-16
MathJaxではtabularが使えない、表作成はarrayで
LaTeXのtabular機能をWeb表示することが出来なくて困っていましたが、こちらを見てすんなり解決。数式表示にバグが出ているものとばかり思っていたのでなかなか気付きませんでした。
2024-01-05
アマゾンアソシエイトの画像が表示されなくなった件
ブログで表示されていたアマゾン商品の画像が見られなくなったので調べたところ今年から画像リンクが廃止されたとのこと。(2023年11月10日付けで発表されていたらしい。)これまで本の紹介などで多用していたので困りました。どうしようもないので商品画像のURLを取得して復旧することにしました。URLがない場合はテキストリンクに変更します。参考にしたサイトはこちら。量が多いので気長にやるか~。
2023-03-24
Ask ChatGPT on something about Chern-Simons theory
> level quantization of chern-simons theory
In Chern-Simons theory, the level quantization refers to the fact that the level parameter $k$, which appears in the action of the theory, must take on integer values in order for the theory to be well-defined.
Chern-Simons theory is a topological quantum field theory that describes the behavior of certain gauge fields, such as electromagnetism, in three dimensions. The action of the theory involves a term that is proportional to the integral of the trace of a product of gauge potentials and their differentials. This term is known as the Chern-Simons term and is given by:
$S[A] = \frac{k}{4\pi} \int \Tr \left( A \wedge dA + \frac{2}{3} A \wedge A \wedge A \right) $
where $A$ is the gauge potential, $dA$ is its differential, $\wedge$ denotes the wedge product, $\Tr$ denotes the trace, and $k$ is the level parameter.
The level parameter $k$ plays an important role in the theory, as it determines the strength of the Chern-Simons term relative to other terms in the action. In particular, the Chern-Simons term is a topological term that does not depend on the metric of spacetime, and is therefore not renormalized by quantum corrections. However, the coefficient $k$ can be renormalized, and this leads to level quantization.
The level quantization arises from the fact that the path integral formulation of the theory requires that the action be well-defined. In particular, the path integral must converge, which requires that the integral of the exponential of the action be finite. This, in turn, requires that the level parameter $k$ be quantized. Specifically, the level must take on integer values in order for the theory to be well-defined.
This level quantization has important physical consequences, as it leads to the appearance of fractional statistics in certain physical systems. For example, in the fractional quantum Hall effect, electrons in a two-dimensional system are described by an effective Chern-Simons theory with a fractional value of the level parameter, which leads to the emergence of anyons with fractional statistics.
Overall, the level quantization of Chern-Simons theory is an important aspect of the theory that has implications for both mathematics and physics. It is an example of the deep connection between topology and quantum field theory, and has led to important insights into the behavior of physical systems at low temperatures and in the presence of strong magnetic fields.
> tell me about abelian chern-simons theory on the torus
Abelian Chern-Simons theory on the torus is a quantum field theory that is defined on a two-dimensional torus, which is a flat, doughnut-shaped surface. It is a special case of Abelian Chern-Simons theory, which is a three-dimensional topological field theory that describes the behavior of certain gauge fields, such as electromagnetism.
In Abelian Chern-Simons theory on the torus, the physical fields are the gauge potential $A(x,y)$ and a scalar field $\phi (x,y)$, where $(x,y)$ are the coordinates on the torus. The action for this theory takes the form:
$S[A, \phi ] = \frac{k}{4\pi} \int dxdy ( \ep^{\mu\nu\la} A_\mu \d_\nu A_\la + \phi \ep^{\mu \nu \la} \d_\mu A_\nu \d_\la \phi )$
where $\ep^{\mu \nu \la}$ is the Levi-Civita tensor in two dimensions, and $k$ is a constant known as the level of the theory.
The equations of motion for this theory are given by the Maxwell equations with an additional term due to the presence of the scalar field:
$ \d_\mu F_{\mu \nu} = k \ep^{\mu \nu \la} \d_\mu \phi \d_\la \phi$
$\d_\mu \d_\mu \phi = k \ep^{\mu \nu \la} F_{\mu\nu}$
where $F_{\mu\nu} = \d_\mu A_\nu - \d_\nu A_\mu$ is the field strength tensor.
One interesting feature of Abelian Chern-Simons theory on the torus is that it leads to the emergence of topological excitations known as magnetic flux tubes. These flux tubes are two-dimensional analogues of the anyons that arise in three dimensions, and are characterized by a topological invariant known as the magnetic flux, which is quantized in units of the level $k$.
Abelian Chern-Simons theory on the torus has applications in condensed matter physics, where it is used to describe the behavior of certain two-dimensional materials known as fractional quantum Hall systems. It is also of interest in string theory, where it arises as an effective field theory in certain compactifications of the theory.
2023-02-08
2023-02-05
uleFone Note 6P に LINEMO SIM を入れてみる2
前回の続きです。お昼前にSIMが届いたの早速作業開始。SIMだけでは電話番号がわかりませんでした。そこで新規のグーグルアカウントを電話番号なしで作成して後から追加することにしました。格安スマホ uleFone Note 6P のバックカバーを開けっぱなしにしていたので素直にSIM1と書いてある挿入口に(金色のほうが表になるように)SIMを入れて、起動させました。起動させるにはバックカバーをカチッとつけなければいけませんでした。
ところがこれではSIMを認識してくれませんでした。再び開けるのは面倒なのでそのまま新しいグーグルアカウントでセットアップ。以前にやったばかりなので問題ありませんでした。LINEのビデオ通話をメインで利用するだけなので余計なアプリは入れませんでした。Wi-Fi接続も問題なくセットアップ終了。その後、再度バックカバーを開けて今度はSIM2と書いてある挿入口に(金色のほうが裏になるように)SIMをを入れて、起動させるとLINEMOを認識してくれました! バックカバーは一度開けてあるので再度開けるのは問題ありませんでした。
電話番号は「設定→デバイス情報→電話番号(SIMスロット2)」で確認できました。ただし、一度再起動しないと表示されませんでした。その後、LINEをインストールして新規アカウントを作成しようとしましたが認証番号を入れるところでうまくいきませんでした。
2023-02-03
uleFone Note 6P に LINEMO SIM を入れてみる1
入院中の家族とオンライン面会のためにスマホ端末が必要になったので以前興味本位で購入していた uleFone Note 6P を使うことにしました。下準備もせずにとりあえず電源ON、日本語に設定してSIMカード入れずに設定を進めました。自分のGmailアカウントで登録、家のWi-FiでLINEのインストールもできました。意外にスムーズでした。ただ、考えてみると病院のスタッフに扱ってもらう端末なので自分のグーグルアカウントを使うのはよくありません。一度、出荷時の状態にリセットしました。さらに院内のWi-Fiが使えるとは限らないので、電話番号も新たに取得する必要があります。格安スマホ(9999円)なので格安SIMを入れるのが妥当でしょう。LINEのビデオ通話しかやらない予定なのでキャンペーン中のLINEMOのSIM(ミニプラン、月額990円)にしました。対応機種ではないので使えるかどうか不安ですがやるだけやってみます。手続きはPCよりもやりやすそうなスマホで行いました。この時は自分のGmailアカウントを利用。
2022-05-06
さくらVPSでSSL更新
何度やっても忘れているのでもしものためのメモ。一年毎更新のJPRSドメイン認証型SSLの場合について。更新手続きはこちら
「オンラインから更新」を選択。登録クレジットカード情報を確認してからオプションは
ドメイン所有権確認方法 ファイル認証
ダブルアドレスオプション 申し込まない
SSLサーバ設定代行サービス 申し込まない
とする。サーバーに変更が無いの場合は以前の鍵ファイル、CSRファイルを利用して更新申請。暫くするとsakura internet会員メニュー画面で認証ファイルが発行されるので指定のディレクトリにアップロード。この際、
<重要>
・コモンネーム対象先にアクセス制限(ベーシック認証、IPアドレス制限等)を
かけている場合は、SSLサーバ証明書が発行されるまで解除してください。
・証明書取得後、認証ファイルは削除されません。削除される際はお客様自身で
お願いいたします。
・認証期間は25日間です。
認証期間内にSSLサーバ証明書が発行されない場合、お申込みがキャンセルと
なります。
とのこと。.htaccess ファイルを一時的に名前を変更(例えば、.htaccess_Old01 など)とし証明書が発行されたら元に戻す。
認証ファイルが確認されたら sakura internet会員メニュー画面から証明書 server.crtをダウンロード。複数の証明書を更新する場合
server_2021.crt
server01_2021.crt
server02_2021.crt
などとして古いファイルを残しておく。新しいファイルはこれまで同様
server.crt
server01.crt
server02.crt
とすると、httpd.conf を編集する必要なし。最後に (必要であればroot権限で) httpd 再起動
service httpd restart
してサイトを確認。以上、毎年のことなので面倒くさがらず、しっかりスケジューリングしてやっと来たかという気持ちで取り組む。
2022-02-01
さくらVPSでSSL設定4:(JPRSドメイン認証型の場合)有効期限前月の更新は不可
SSLの更新は年に一度ぐらいしかやらないので忘れがちです。以前は期限が切れたので新規にSSL証明書を発行してもらう必要がありました。今回はそのようなことが無いようにカレンダーにリマインドしてフライング気味にSSL更新の手続きを行いました。古い証明書が2/28が切れるので1/31にこちらから更新手続きを行いました。
昔の設定記録を思い出しながら、CSRファイルを用意しました。以前同様、認証ファイルをダウンロードして指定のディレクトリに配置したのですが、半日経っても認証ファイルを認識してくれず、証明書が発行されません。
これまで15分ほどで発行されていたのでこちらの設定ミスだろうとこちらのファイル認証トラブルシューティングを参考にしましたが、全く解決しませんでした。サーバ設定などに変更が無いのでCSRファイル(と鍵ファイル)を使い回して変更しなかったのが原因なのかと判断して、さくらインターネットのサポート担当の方に更新手続きを一度キャンセルしてもらえないかどうか問い合わせました。しばらくすると何故か証明書が発行されていて、サポート担当の方から
1.認証ファイル設置後、証明書が発行されなかった原因は「更新可能期間でなかったため」であること。2.認証局であるJPRSでは、仕様上更新証明書は「元証明書の有効期限当月」になるまで発行できません。
との的確な回答を頂きました。今回、更新前の証明書の有効期限が【2022/02/28】だったので、1/31に認証ファイルをアップしても認証されなかったようです。本来はCSRファイルを再生成するべきなのでしょうが、それが原因でなかったことが分かっただけでも良かったです。といっても古いCSRを使い回すのは良くなさそうです。そのあたりは更新申請時にチェックしてくれると有り難いのですが。
サポート担当の方からSSL証明書の更新手続きの際に「更新」のラジオボタンをチェックすれば更新可能期間でないものについてはバリデーションがかかるとのコメントがありましたが、私の記憶では「更新」のラジオボタンをチェックして手続きしたはずなんだけどなあ。とりあえず、無事に更新できたので良しとします。次回以降は元の証明書の有効期限当月になってから更新手続きを始めたいと思います!
2021-08-07
CentOS4.9, Apache2.0, PHP5.1, Smarty2.6 から CentOS7.9, Apache2.4, PHP5.6, Smarty2.6 へシステム移行
前回の続きの作業記録です。 前回はCentOS7に(対応している一番古いバージョンの)PHP5.6を入れてphpMyAdminも使えるようにしました。この環境にCentOS4.9, PHP5.1, Smarty2.6で動いているシステムを移行したいという依頼だったのですが、PHPバージョンアップに伴うエラーが続出したため、PHP5.1か5.2に入れ替えることを提案したのですが、そのまま5.6で何とかして欲しいということなのでとりあえずトライしました。
PHPのエラーとして
PHP Fatal error: Call-time pass-by-reference has been removed in ...
というのがあり、これは参照渡しの fatal error とのことです。
を参考にして対応しました。また、
PHP Parse error: syntax error, unexpected 'goto' (T_GOTO), expecting identifier (T_STRING) in ...
という parse error が出たのですが、PHP5.3以降からは goto という名前の関数は使えないそうです。
Smartyについては新しくインストールせず、そのまま古いファイルをごっそりコピーしました。
PHP Fatal error: Smarty error: unable to write to $\$$compile_dir '/.../libs/smarty/templates_c'. Be sure $compile_dir is writable by the web server user. in /.../libs/smarty/libs/Smarty.class.php
とエラーが出たので該当ディレクトリのパーミッションを chmod0777 としました。それ以外にも公開画像やファイルが入っているディレクトリのパーミッションを変更しました。Smarty2についてはPHP5.1からPHP5.6にあげてもとりあえずは動いてくれるようです。
2021-08-02
さくらVPS CentOS7 に PHP5.6, phpMyAdminインストール
さくらVPS CentOS7.9 に PHP5.6(CentOS7に対応する一番古いバージョン)と対応する phpMyAdmin をインストールしたので記録しておきます。CentOSのバージョンは
# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
●apache install
公式サイトの解説を参考にしました。
# yum update
Complete!
# yum install httpd
Complete!
# systemctl start httpd
OKもNGも何も出てきませんが、これでhttpdが起動できたそうです。
# firewall-cmd --add-service=http --zone=public --permanent
FirewallD is not running
# systemctl start firewalld
# firewall-cmd --add-service=http --zone=public --permanent
success
# firewall-cmd --add-service=https --zone=public --permanent
success
# systemctl restart firewalld
としましたが、ブラウザでapache確認できませんでした。上記解説URLを良く見るとパケットフィルタの設定をしていなかったことが原因でした。パケットフィルタの設定で「Web(80/443)」を許可すると、無事表示されました!
# systemctl start httpd.service
# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 16 2020 16:18:20
ついでにパケットフィルターでFTP,mailも許可しておきました。
●PHP5.6インストール
を参考にしました。
# yum install epel-release
Nothing to do
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# yum install --enablerepo=remi,remi-php56 php php-devel php-mbstring php-pdo php-gd php-xml php-mcrypt
Complete!
# php -v
PHP 5.6.40 (cli) (built: Jun 28 2021 14:40:12)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
php.ini 編集
# cd /etc
# cp php.ini php.ini.old
# vim php.ini
post_max_size = 128M
...
upload_max_filesize = 128M
と変更して再起動。
# systemctl restart httpd
# echo "<?php phpinfo(); ?>" > /var/www/html/info.php
http://160.xx.xxx.xxx/info.php
OK!!
2021-05-08
GoogleAPI OAuth2.0のリダイレクトURIがhttps必須に変更されていた件
Google Cloud Platform (以前のGoogle Apps) でログイン認証のAPI OAuth2.0 を利用しています。ウェブアプリに組み込んでいるのですが、以前までAPIに必要なリダイレクトURIはSSL対応していないもの (http:// ではじまるURI) でも登録できたのですが、先日久しぶりに登録しようとするとSSL化された (https:// ではじまる) URIでないと登録できないようになっていました。今の所、古いものでもAPIは使えるようですがいつ使えなくなるか分かりません。そこで、こちらを参考にしてシステムのSSL化を行いました。(追記6/3:予想通り今年の9/13にはSSL化されていないURIは削除されるとの連絡が Google Developers から来ました。)
今回は既存の /etc/httpd/conf.d/ssl.conf ファイルを編集することにしました。SSLの証明書が発行され、関連するファイルが以下の通り置かれているとします。
SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key
SSLCertificateChainFile /etc/httpd/conf/ssl.crt/internal.cer
SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt
システムのルートが /var/www/html/example にあるとして、ドメインが example.biz の場合 ssl.conf ファイルに以下の項目を追加すればOKです。
# setting for example.biz
<VirtualHost *:443>
SSLEngine on
SSLProtocol all -SSLv2
SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key
SSLCertificateChainFile /etc/httpd/conf/ssl.crt/internal.cer
SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt
DocumentRoot /var/www/html/example
ServerName example.biz:443
ErrorLog /var/log/httpd/example-error_log
CustomLog /var/log/httpd/example-access_log common
AddDefaultCharset UTF-8
<Directory "/var/www/html/example/">
AllowOverride All
Options Indexes FollowSymLinks
</Directory>
</VirtualHost>
2021-05-06
phpMyAdminでDBを別のDBに構造だけコピーしたい時
たまにしか行わない作業なので念のため記録しておきます。phpMyAdminでコピーしたいDBをクリック、画面上部の「操作」から「データベースのコピー先」へ移動し、新しいDBの名前を入力し、「構造のみ」、「コピーの前に CREATE DATABASE する」を選択して、残りのチェックは外し、実行ボタンを押すとデータなし構造のみのDBが作成されます。楽だなあ。運用中のDB(9個のテーブル含む)をボタン1つでごっそりコピーできるのはありがたいです。コピーだから大丈夫なはずですが、元データが実行中に何かの問題で無くなったり、破損したりするのではないかと余計なことを考えてしまいました。今後も取り扱いには注意して利用したいです。
2021-03-29
AmazonEC2サーバへ libreoffice インストール
システムの移行に伴いAmazonEC2サーバへPager.phpとlibreofficeをインストールしたので記録しておきます。Pager.phpの場合は
$\$$ sudo yum install php-pear
$\$$ sudo pear install Pager
$\$$ sudo pear install Pager
とすると簡単できました。libreofficeの場合は
$\$$ sudo yum install libreoffice
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 3.7 kB 00:00:00
229 packages excluded due to repository priority protections
No package libreoffice available.
Error: Nothing to do
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core | 3.7 kB 00:00:00
229 packages excluded due to repository priority protections
No package libreoffice available.
Error: Nothing to do
となりyumが使えなかったので
https://qiita.com/mosin_nozomi/items/67702903b2be980458b0
https://qiita.com/unvavo/items/8302ea50235da0ea69fb
https://www.memo-kyu.com/2020/02/libre-office-amazon-linux.html
https://gist.github.com/umair-khokhar/11516a692a21d3de05751f50056bf4dd
https://qiita.com/unvavo/items/8302ea50235da0ea69fb
https://www.memo-kyu.com/2020/02/libre-office-amazon-linux.html
https://gist.github.com/umair-khokhar/11516a692a21d3de05751f50056bf4dd
などを参考に公式サイトから新しいバージョン
https://ja.libreoffice.org/download/download/?type=rpm-x86_64&version=7.0.5&lang=ja
ダウンロードしたのですが、上手くいかなかったのでAWSのサイト
https://aws.amazon.com/jp/premiumsupport/knowledge-center/ec2-install-extras-library-software/
を参考にするとさっくりとインストールできました。
$\$$ amazon-linux-extras
...
...
18 libreoffice available \
[ =5.0.6.2_15 =5.3.6.1 =stable ]
...
[ =5.0.6.2_15 =5.3.6.1 =stable ]
...
$\$$ sudo amazon-linux-extras enable libreoffice
$\$$ sudo yum install libreoffice
...
Complete!
$\$$ sudo yum install libreoffice
...
Complete!
確認のためPPTXファイルをPDFに変換してみました。例えば、
$\$$ libreoffice --headless --nologo --nofirststartwizard --convert-to pdf /var/www/html/upfile/testfile.pptx --outdir /var/www/html/upfile
とすると文字化けしてしまうため
$\$$ sudo yum install libreoffice-langpack-ja
として日本語パッケージを入れると解決しました。
登録:
投稿 (Atom)