コンテンツにスキップ

「XAMPP」の版間の差分

提供: ArchWiki
削除された内容 追加された内容
Troubleshooting: 記事を差し替え
143行目: 143行目:


最後のカラムが LISTEN になっているエントリの、Listen カラムを見て下さい。0.0.0.0 ではなく 127.0.0.1 や ::1 で始まっているはずです。
最後のカラムが LISTEN になっているエントリの、Listen カラムを見て下さい。0.0.0.0 ではなく 127.0.0.1 や ::1 で始まっているはずです。

=== Manual installation ===

To install XAMPP manually instead of following [[#Installation]], download the installer from [https://www.apachefriends.org/index.html the website], make it [[executable]] and run it by typing:

# ./xampp-linux-x64-''version''-installer.run

{{Note|The {{Pkg|libxcrypt-compat}}, {{Pkg|net-tools}} and {{Pkg|inetutils}} packages are required dependencies, so make sure they are installed before launching XAMPP.}}

{{Tip|By default the installer uses the Qt backend for its UI. If you want it to use the GTK backend instead, launch:

{{bc|# ./xampp-linux-x64-''version''-installer.run --mode gtk}}

If you do not want to use any graphical interface and prefer to install XAMPP directly from the terminal, launch:

{{bc|# ./xampp-linux-x64-''version''-installer.run --mode text}}

For further options, launch as normal user:

{{bc|$ ./xampp-linux-x64-''version''-installer.run --help}}}}

You can now create a [[systemd]] service for XAMPP:

{{hc|/etc/systemd/system/xampp.service|2=
[Unit]
Description=XAMPP

[Service]
ExecStart=/opt/lampp/xampp start
ExecStop=/opt/lampp/xampp stop
Type=forking

[Install]
WantedBy=multi-user.target
}}

==== Manual removal ====

If you have installed XAMPP manually you will need to remove it manually as well. Be sure to stop all XAMPP services.

# /opt/lampp/xampp stop

All the files needed by XAMPP to be installed are located in the previous {{ic|/opt/lampp}} folder. So, to uninstall XAMPP:

# rm /etc/systemd/system/xampp.service
# rm -r /opt/lampp

{{Note|
* Be sure to backup your files before doing this (such as files in {{ic|/opt/lampp/htdocs}}).
* If you created symlinks, you may need to destroy them too.
* Do not use this method if you have [[#Installation|installed the package]]; [[uninstall]] the package instead.
}}


== トラブルシューティング ==
== トラブルシューティング ==

2023年1月19日 (木) 13:57時点における版

XAMPP は MySQL, PHP, Perl などが含まれた簡単にインストールできる Apache のディストリビューションです。以下のものが含まれています: Apache, MySQL, PHP & PEAR, Perl, ProFTPD, phpMyAdmin, OpenSSL, GD, Freetype2, libjpeg, libpng, gdbm, zlib, expat, Sablotron, libxml, Ming, Webalizer, pdf class, ncurses, mod_perl, FreeTDS, gettext, mcrypt, mhash, eAccelerator, SQLite, IMAP C-Client。

インストール

ウェブサイト からインストーラーをダウンロード・インストールしてください。

ダウンロードするファイルはインストーラースクリプトです。実行可能属性を付与して以下のコマンドで実行します:

# chmod +x xampp-linux-version-installer.run 
# ./xampp-linux-version-installer.run 

削除

lampp のサービスを全て停止してください:

# /opt/lampp/lampp stop

Xampp によってインストールしたファイルは全て前記の /opt/lampp フォルダに配置されます。したがって、Xampp をアンインストールするには:

# rm -rf /opt/lampp
ノート シンボリックリンクを作成していた場合は、シンボリックリンクも削除する必要があります。

設定

XAMPP の各パーツの設定は以下の設定ファイルを編集することで行います:

/opt/lampp/etc/httpd.conf - Apache の設定。例えば、ウェブページのソースファイルのフォルダを変更できます。

/opt/lampp/etc/php.ini - PHP の設定。

/opt/lampp/phpmyadmin/config.inc.php - phpMyAdmin の設定。

/opt/lampp/etc/proftpd.conf - proFTP の設定。

/opt/lampp/etc/my.cnf - MySQL の設定。

サーバーのセキュリティをセットアップしたいときは、次のコマンドを実行するだけで設定できます:

# /opt/lampp/lampp security

ウェブページにアクセスするのに必要なパスワード、phpMyAdmin のユーザー "pma" のパスワード、MySQL のユーザー "root" のパスワード、proFTP のユーザー "nobody" のパスワードを順に入力します。

使用方法

XAMPP の制御は以下のコマンドを使います:

# /opt/lampp/lampp start,stop,restart

もしくは、xampp.service開始停止または再起動します。

ブート時に自動起動する

ブート時に XAMPP を起動するには、xampp.service有効化します。

ヒントとテクニック

htdocs ディレクトリの外のファイルをホスト

ドキュメントのルートディレクトリ (ウェブルート) は /opt/lampp/htdocs/ です。このディレクトリに置いたファイルは全てウェブサーバーによって扱われます。

システムの他のファイルを XAMPP でホストするには、apache でエイリアスを設定します。

  • お好きなエディタで apache の httpd.conf を編集して下さい:
# nano /opt/lampp/etc/httpd.conf
  • "DocumentRoot" を見つけて下さい、以下のようになっているはずです:
DocumentRoot "/opt/lampp/htdocs"
<Directory "/opt/lampp/htdocs">
    ...    
    ...

</Directory>
  • "</Directory>" の後に以下を貼り付けます:
<Directory "/yourDirectory/">
    Options Indexes FollowSymLinks ExecCGI Includes
    AllowOverride All
    Require all granted
</Directory>
  • それから "<IfModule alias_module>" を探して下さい:
<IfModule alias_module>

    #
    # Redirect: Allows you to tell clients about documents that used to 
    # exist in your server's namespace, but do not anymore. The client 
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar
  ...
</IfModule>
  • "</IfModule>" の前に以下を貼り付けて下さい:
Alias /yourAlias /yourDirectory/
  • 忘れずに Apache を再起動してください:
# /opt/lampp/lampp restart

これでホームディレクトリのファイルが XAMPP によってホストされるようになります。

上記の例では、ウェブブラウザで localhost/yourAlias を開くことでファイルにアクセスできます。

Xdebug と Xampp によるデバッグとプロファイル

詳しい方法は こちら を見て下さい。

まず ここ のダウンロードページから Xampp Development Tools をダウンロードしてください。

Xampp ディレクトリに展開します:

# tar xvfz xampp-linux-devel-x.x.x.tar.gz -C /opt

xdebug フォルダで以下のコマンドが実行できるはずです:

/opt/lampp/bin/phpize

ローカルテストサーバーのセキュリティ

Apache と MySQL を設定することで同一のコンピュータからのリクエストだけに受け答えをするようにできます。インターネットからサービスにアクセスできなくなるため、大抵のテストシステムではこれでセキュリティのリスクを大きく減らすことが可能です。

初めて XAMPP を起動する前に、以下のファイルを編集して下さい:

Apache の設定は、xampp\apache\conf\httpd.confxampp\apache\conf\extra\httpd-ssl.conf ファイルを編集してください。以下のように "Listen" から始まる行を探します:

Listen 80

そして以下のように置き換えてください:

Listen 127.0.0.1:80

MySQL の設定は、xampp\mysql\bin\my.cnf ファイルを開いて "[mysqld]" セクションを探して、以下の行を追加してください:

bind-address=localhost

サービスの起動後、コマンドウィンドウを開いて以下のコマンドを実行することでセキュリティの確認ができます:

netstat -a -n

最後のカラムが LISTEN になっているエントリの、Listen カラムを見て下さい。0.0.0.0 ではなく 127.0.0.1 や ::1 で始まっているはずです。

Manual installation

To install XAMPP manually instead of following #Installation, download the installer from the website, make it executable and run it by typing:

# ./xampp-linux-x64-version-installer.run
ノート The libxcrypt-compat, net-tools and inetutils packages are required dependencies, so make sure they are installed before launching XAMPP.
ヒント By default the installer uses the Qt backend for its UI. If you want it to use the GTK backend instead, launch:
# ./xampp-linux-x64-version-installer.run --mode gtk

If you do not want to use any graphical interface and prefer to install XAMPP directly from the terminal, launch:

# ./xampp-linux-x64-version-installer.run --mode text

For further options, launch as normal user:

$ ./xampp-linux-x64-version-installer.run --help

You can now create a systemd service for XAMPP:

/etc/systemd/system/xampp.service
[Unit]
Description=XAMPP

[Service]
ExecStart=/opt/lampp/xampp start
ExecStop=/opt/lampp/xampp stop
Type=forking

[Install]
WantedBy=multi-user.target

Manual removal

If you have installed XAMPP manually you will need to remove it manually as well. Be sure to stop all XAMPP services.

# /opt/lampp/xampp stop

All the files needed by XAMPP to be installed are located in the previous /opt/lampp folder. So, to uninstall XAMPP:

# rm /etc/systemd/system/xampp.service
# rm -r /opt/lampp
ノート
  • Be sure to backup your files before doing this (such as files in /opt/lampp/htdocs).
  • If you created symlinks, you may need to destroy them too.
  • Do not use this method if you have installed the package; uninstall the package instead.

トラブルシューティング

PhpMyAdmin 403 Access Forbidden

http://localhost/phpmyadmin にアクセスしたときに "403 Access Forbidden" が返ってくる場合、/opt/lampp/etc/extra/httpd-xampp.conf の以下の設定を編集して下さい:

<Directory "/opt/lampp/phpmyadmin">
	AllowOverride AuthConfig Limit
	#Order allow,deny
	#Allow from all
	Require all granted
</Directory>