
LiteSpeedはデフォルトでPHPが入っているのですが、なぜかバージョンが5.4です。そして通常PHPをインストールするとなるとSSHによるコマンドですが、もしかしたらLiteSpeedは不要かもしれません。
ダッシュボードにPHPコンパイルがある

PHPのコンパイルという画面があります。ちょっと見ていきたいと思います
PHPのバージョンが指定できる

これはどういうことか、バージョンの指定ができます。画面には映っていないですが次へボタンがあるので押してみます
ビルドオプションの選択

パラメーターもデフォで入ってます。これは凄い。特に何もしなくてもいいかもしれません

なんか普通に成功しました。やった。次いこう
コマンドが必要な画面にでます

セキュリティ上の理由から、サーバーにログインし、シェルから事前生成されたスクリプトを実行してください。 この画面から進行状況を監視することができます。
正常にビルドできたら、必要に応じてphp.iniを更新してください。 変更を適用するには、緩やかな再起動を実行してください。
Iエラーにより停止した場合は、パッケージを紛失したためにインストールした後、同じコマンドを再実行すると、このページに更新されたログが表示されます。LSPHPの詳細については、次のURLを参照してください LiteSpeed wiki.
rootとしてログインした場合は、次のコマンドを直接実行できます:
/usr/local/lsws/phpbuild/buildphp_manual_run.sh
sudo権限を持つユーザーとしてログインした場合は、sudoでコマンドを実行し、プロンプトの後にrootパスワードを入力することができます。
sudo /usr/local/lsws/phpbuild/buildphp_manual_run.sh
どうやらここはコマンドで対応しないといけないみたいです
1 | [root@ik1-343-31745 ~]# /usr/local/lsws/phpbuild/buildphp_manual_run.sh |
管理画面に戻るとエラーになりました。詳細ログを見ると
01 | **LOG_DETAIL** retrieved from /usr/local/lsws/phpbuild/buildphp_1533204918.5. log |
03 | ============================================== |
04 | Start building PHP 7.2.8 with LSAPI |
05 | ============================================== |
06 | Thu Aug 2 19:24:46 JST 2018 |
08 | Changing to build directory /usr/local/lsws/phpbuild/php-7.2.8 |
09 | Configuring PHP build (2-3 minutes) |
10 | ./configure '--prefix=/usr/local/lsws/lsphp7' '--with-mysqli' '--with-zlib' '--with-gd' '--enable-shmop' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-mbstring' '--with-iconv' '--with-mcrypt' '--with-pdo-mysql' '--enable-ftp' '--enable-zip' '--with-curl' '--enable-soap' '--enable-xml' '--enable-json' '--with-openssl' '--enable-bcmath' '--with-litespeed' |
11 | configure: WARNING: unrecognized options: --with-mcrypt |
12 | checking for grep that handles long lines and -e... /bin/grep |
13 | checking for egrep... /bin/grep -E |
14 | checking for a sed that does not truncate output... /bin/sed |
15 | checking build system type... x86_64-unknown-linux-gnu |
16 | checking host system type... x86_64-unknown-linux-gnu |
17 | checking target system type... x86_64-unknown-linux-gnu |
19 | checking whether the C compiler works... yes |
20 | checking for C compiler default output file name... a.out |
21 | checking for suffix of executables... |
22 | checking whether we are cross compiling... no |
23 | checking for suffix of object files... o |
24 | checking whether we are using the GNU C compiler... yes |
25 | checking whether cc accepts -g... yes |
26 | checking for cc option to accept ISO C89... none needed |
27 | checking how to run the C preprocessor... cc -E |
29 | checking for suncc... no |
31 | checking for OpenSSL support... yes |
32 | checking for Kerberos support... no |
33 | checking whether to use system default cipher list instead of hardcoded value... no |
34 | checking for RAND_egd... no |
35 | checking for pkg-config... /bin/pkg-config |
36 | configure: error: Cannot find OpenSSL's <evp.h> |
37 | **ERROR** Could not configure PHP build |
OpenSSLがないとエラーがでました。
1 | [root@ik1-343-31745 ~]# yum install openssl-devel |
でインストールします。その後またエラーがでました。。。
1 | checking for cURL 7.10.5 or greater... configure: error: cURL version 7.10.5 or later is required to compile php with cURL support |
2 | **ERROR** Could not configure PHP build |
cURL関係っぽいです
01 | [root@ik1-343-31745 ~]# yum install curl-devel |
02 | Loaded plugins: fastestmirror, langpacks |
03 | Loading mirror speeds from cached hostfile |
05 | * epel: mirror.dmmlabs.jp |
06 | * extras: ftp.iij.ad.jp |
07 | * updates: ftp.iij.ad.jp |
09 | --> Running transaction check |
10 | ---> Package libcurl-devel.x86_64 0:7.29.0-46.el7 will be installed |
11 | base/7/x86_64/filelists_db | 6.9 MB 00:00:00 |
12 | --> Finished Dependency Resolution |
16 | ============================================================================================================================================================================================================================================================================================================================ |
17 | Package Arch Version Repository Size |
18 | ============================================================================================================================================================================================================================================================================================================================ |
20 | libcurl-devel x86_64 7.29.0-46.el7 base 300 k |
23 | ============================================================================================================================================================================================================================================================================================================================ |
26 | Total download size: 300 k |
30 | libcurl-devel-7.29.0-46.el7.x86_64.rpm | 300 kB 00:00:00 |
31 | Running transaction check |
32 | Running transaction test |
33 | Transaction test succeeded |
35 | Installing : libcurl-devel-7.29.0-46.el7.x86_64 1/1 |
36 | Verifying : libcurl-devel-7.29.0-46.el7.x86_64 1/1 |
39 | libcurl-devel.x86_64 0:7.29.0-46.el7 |
42 | [root@ik1-343-31745 ~]# |
再度コマンドを実行してみます
1 | [root@ik1-343-31745 ~]# /usr/local/lsws/phpbuild/buildphp_manual_run.sh |
またまたエラーです。。というわけで、【PHP】7.0.0 ソースからコマンド最短インストール方法を参考にでたエラーの数だけ必要なのをいれていきます。
成功しました

普通にインストールが成功しました。
ビルドプロセスが成功すると、PHPバイナリは /usr/local/lsws/fcgi-bin/ の配下に名前が lsphp-7.2.8 で作成され、 そして lsphp7 のシンボリックリンクが新しく作成されるか又はビルドされたバイナリが更新されます。 lsphp-7.2.8 が既に存在する場合は、lsphp-7.2.8.bak に名前が変更されます。
とのことですリンク見てみます
1 | [root@ik1-343-31745 ~]# ls /usr/local/lsws/fcgi-bin/ |
2 | RackRunner.rb lsperld.fpl lsphp lsphp-7.2.8 lsphp5 lsphp7 |
リンクがありました。ブラウザ上でPHP7のインストールができました。
PHP7の設定
初期状態ではPHP5.6のため、切り替えをします。これもコンソール画面でできます。
サーバー設定 > 外部アプリ


アクションを押します
コマンドを修正
デフォルトのコマンド$SERVER_ROOT/fcgi-bin/lsphpを変更します変更コマンドは$SERVER_ROOT/fcgi-bin/lsphp7となります
PHP7に変更完了
この後再起動するだけで変更完了です。なんと楽な・・・
追記
デフォルトの状態だとphp-gdでjpegがサポートされていないため、jpegサポートする方法を追記します
1 | [root@ik1-343-31745 /]# yum install libjpeg-devel |
インストールしたらどこにインストールされたか確認します
1 | [root@ik1-343-31745 /]# find /usr/ -name libjpeg.so |
見つかりました
再コンパイル
ビルドオプションに--with-jpeg-dir=/usr/lib64/libjpeg.soを追記して再コンパイルします。これでjpegもサポートされます
個人支援・寄付について
サイトラボでは個人支援・寄付を受けております。ご協力いただける方はお願いいたします。当サイトではビットコインで受け付けております。
- ビットコイン:3LHnADwZwUbic2L45EnVJEykiG6KfbqrwS