OS X 经常提到的问题

What is the difference between XAMPP for OS X and XAMPP-VM?

  • XAMPP for OS X is a native installer for OS X. It installs Apache, PHP and other XAMPP components directly on your OS X system, in the /Applications/XAMPP folder.
  • XAMPP-VM is a virtual machine for OS X. It includes Apache, PHP and other XAMPP components and runs them in a Linux-based virtual machine on your OS X system.

For more information, refer to the blog post at https://www.apachefriends.org/blog/new_xampp_20170628.html.

.
我如何在Mac OS X上安装XAMPP?

要安装XAMPP只需参考如下操作:

  • 打开 DMG-Image。
  • 双击图片,开始安装。

完成了。XAMPP现在已经在/Applications/XAMPP目录下安装完毕。

Does XAMPP include MySQL or MariaDB?

Since XAMPP 5.5.30 and 5.6.14, XAMPP ships MariaDB instead of MySQL. The commands and tools are the same for both.

如何启动XAMPP?

要启动XAMPP只需打开XAMPP控制台并启动Apache、MySQL和ProFTPD。XAMPP控制台的名称是“manager-osx”。

如何停止运行XAMPP?

要关闭XAMPP只需打开XAMPP控制台,然后关闭服务器。XAMPP控制台的名称是“manager-osx”。

我如何检查是否一切正常?

在浏览器中输入以下链接:

http://localhost

You should see the XAMPP start page, as shown below.

XAMPP准备好了吗?

XAMPP是一个非常优秀而又实用的开发测试环境,XAMPP的配置是开放的,允许开发者任意去修改或配置适合您的开发环境。XAMPP并非商业运行环境,用于商业运作将是一个致命的环境!

如下是XAMPP不安全的配置:

  1. MySQL数据库管理帐号 (root)没设置密码。
  2. MySQL数据库可以通过网络打开。
  3. ProFTPD uses the password "lampp" for user "daemon".

解决简单问题的安全命令:

sudo /Applications/XAMPP/xamppfiles/xampp security

这会启动一个基本的安全检查,以便于确保XAMPP安装的安全。

看到有XAMPP启动时的错误信息?

你可能会得到一些XAMPP启动错误信息

LAMPP-Apache is already running.
An Apache daemon is already running.

由于另外一个Apache正在运行,所以没能成功启动XAMPP-Apache。如想正常启动XAMPP-Apache,先把另外一个Apache停止运行。

LAMPP-MySQL is already running.
A MySQL daemon is already running.

这又是相同的一个原因,另外一个MYSQL正在运行,所以没能成功启动MYSQL。如想正常启动,先把另外一个MYSQL停止运行。

Apache doesn't seem to start. What can I do?

这个错误可能存在多种原因,Apache提示有多种错误的话,我们找出的错误:

tail -2 /Applications/XAMPP/logs/error_log

如果收到任何错误信息,请访问 %{社区} 寻求帮助。

如何让XAMPP更安全?

默认安装时,XAMPP没有设置密码,但是我们不推荐这种可以被其他人访问的配置来运行XAMPP

只需(以root用户)输入以下命令就可以进行简单的安全检察:

sudo /Applications/XAMPP/xamppfiles/xampp security

现在您应该可以在屏幕上看到如下对话框:

XAMPP: Quick security check...
XAMPP: MySQL is accessable via network.
XAMPP: Normaly that's not recommended. Do you want me to turn it off? [yes] yes
XAMPP: Turned off.
XAMPP: Stopping MySQL...
XAMPP: Starting MySQL...
XAMPP: The MySQL/phpMyAdmin user pma has no password set!!!
XAMPP: Do you want to set a password? [yes] yes
XAMPP: Password: ******
XAMPP: Password (again): ******
XAMPP: Setting new MySQL pma password.
XAMPP: Setting phpMyAdmin's pma password to the new one.
XAMPP: MySQL has no root passwort set!!!
XAMPP: Do you want to set a password? [yes] yes
XAMPP: Write the passworde somewhere down to make sure you won't forget it!!!
XAMPP: Password: ******
XAMPP: Password (again): ******
XAMPP: Setting new MySQL root password.
XAMPP: Setting phpMyAdmin's root password to the new one.
XAMPP: The FTP password for user 'nobody' is still set to 'lampp'.
XAMPP: Do you want to change the password? [yes] yes
XAMPP: Password: ******
XAMPP: Password (again): ******
XAMPP: Reload ProFTPD...
XAMPP: Done.

(1)设置密码就会用这个密码来保护XAMPP演示的页面(http://localhost/xampp/)。用户名为‘lampp’!

通过调用这条命令您的XAMPP安装过程会更加安全。

如何为PHP激活OCI8/Oracle扩展?

启动OCI8/Oracle的PHP扩展,请执行以下命令:

sudo /Applications/XAMPP/xamppfiles/lampp oci8

下面的对话框就会启动:

Please enter the path to your Oracle or Instant Client installation:
[/Applications/XAMPP/xamppfiles/lib/instantclient-11.2.0.3.0]
installing symlinks...
patching php.ini...
OCI8 add-on activation likely successful.
LAMPP: Stopping Apache with SSL...
LAMPP: Starting Apache with SSL...

现在扩展程序将会激活。

How do I enable access to phpMyAdmin from the outside?

In the basic configuration of XAMPP, phpMyAdmin is accessible only from the same host that XAMPP is running on, at http://127.0.0.1 or http://localhost.

IMPORTANT: Enabling external access for phpMyAdmin in production environments is a significant security risk. You are strongly advised to only allow access from localhost. A remote attacker could take advantage of any existing vulnerability for executing code or for modifying your data.

To enable remote access to phpMyAdmin, follow these steps:

  • Edit the xamppfiles/etc/extra/httpd-xampp.conf file in your XAMPP installation directory.
  • Within this file, find the lines below.

    Alias /phpmyadmin "/Applications/XAMPP/xamppfiles/phpmyadmin" <Directory "/Applications/XAMPP/xamppfiles/phpmyadmin"> AllowOverride AuthConfig Require local

  • Then replace 'Require local' with 'Require all granted'.
  • Alias /phpmyadmin "/Applications/XAMPP/xamppfiles/phpmyadmin" <Directory "/Applications/XAMPP/xamppfiles/phpmyadmin"> AllowOverride AuthConfig Require all granted

  • Restart the Apache server using the XAMPP control panel.
Where are the main XAMPP configuration files?

The main XAMPP configuration files are located as follows:

  • Apache configuration file: /Applications/XAMPP/xamppfiles/etc/httpd.conf, /Applications/XAMPP/xamppfiles/etc/extra/httpd-xampp.conf
  • PHP configuration file: /Applications/XAMPP/xamppfiles/etc/php.ini
  • MySQL configuration file: /Applications/XAMPP/xamppfiles/etc/my.cnf
  • ProFTPD configuration file: /Applications/XAMPP/xamppfiles/etc/proftpd.conf
How do I send email with XAMPP?

To send email with XAMPP, use the PEAR Mail and Net_SMTP packages, which allow you to send email using an external SMTP account (such as a Gmail account). Follow these steps:

  • Install the Mail and Net_SMTP PEAR modules: pear install Net_SMTP Mail Note that if these packages are already installed in your system you see the messages below when executing that command: Ignoring installed package pear/Net_SMTP Ignoring installed package pear/Mail Nothing to install
  • Create the following example script in your "htdocs" directory to send an email: <?php require_once "Mail.php"; $from = "your-gmail-username@gmail.com"; $to = 'recipients@example.com'; $host = "ssl://smtp.gmail.com"; $port = "465"; $username = 'your-gmail-username@gmail.com'; $password = 'your-gmail-password'; $subject = "test"; $body = "test"; $headers = array ('From' => $from, 'To' => $to,'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo($mail->getMessage()); } else { echo("Message successfully sent!\n"); } ?>

    Remember to replace the dummy values shown with your actual Gmail address and account password. If you don't plan to use Gmail's SMTP server, replace the SMTP host details with appropriate values for your organization or ISP's SMTP server.

  • Execute the script by browsing to it using your Web browser. You should see a notification that the message was successfully sent, and the message should be delivered to the recipient email address.
我如何备份/恢复我的XAMPP系统?

警告: 备份和恢复功能目前还处于开发阶段,所以目前可能还不能工作。

你可以通过调用如下命令来创建备份:

sudo /Applications/XAMPP/xamppfiles/xampp backup

sudo /Applications/XAMPP/xamppfiles/xampp backup secret

”secret“代表你的MySQL root密码。这行命令会产生以下输出:

Backing up databases...
Backing up configuration, log and htdocs files...
Calculating checksums...
Building final backup file...
Backup finished.
Take care of /Applications/XAMPP/xamppfiles/backup/xampp-backup-22-01-14.sh

文件 /Applications/XAMPP/xamppfiles/backup/xampp-backup-22-01-14.sh(在上面的例子中)包含了你的备份的数据。请将它保存在安全的地方。

在新机器上,你需要一个和你的最初/源机器上相同版本的AXMPP.

sudo sh xampp-backup-22-01-14.sh

你会看到一些类似这样的东西:

Checking integrity of files...
Restoring configuration, log and htdocs files...
Checking versions...
Installed: XAMPP 1.4.2
Backup from: XAMPP 1.4.2
Restoring MySQL databases...
Restoring MySQL user databases...
Backup complete. Have fun!
You may need to restart XAMPP to complete the restore.

这样就可以了。记住那只是一个测试版本的功能。