分步解决方案、配置指南和最佳实践,以充分利用 XAMPP。
Visit the 下载 page and select the installer for your operating system. Make sure to download from the official SourceForge mirror to ensure file integrity.
Double-click the downloaded file. On Windows, you may see a User Account Control prompt - click "Yes." On macOS, drag the XAMPP icon to your Applications folder. On Linux, extract the tar.gz and run the setup script.
During installation, choose the components you need. By default, Apache, MariaDB, PHP, and phpMyAdmin are selected. You can also include FileZilla, Tomcat, Mercury Mail, and Perl depending on your project requirements.
We recommend installing to the default location (C:\xampp on Windows, /opt/lampp on Linux, /Applications/XAMPP on macOS). Avoid paths with spaces or special characters to prevent permission issues.
After installation, open the XAMPP Control Panel. Click "Start" next to Apache and MySQL. Open your browser and navigate to http://localhost to verify everything is working.
If port 80 is already in use (common with Skype, IIS, or other web servers), you need to change Apache's listening port.
httpd.conf.Listen 80 and change it to Listen 8080.ServerName localhost:80 and change to ServerName localhost:8080.http://localhost:8080.Virtual hosts allow you to run multiple local websites with custom domain names like myproject.local.
C:\Windows\System32\drivers\etc\hosts (run Notepad as Administrator).127.0.0.1 myproject.local.httpd-vhosts.conf from the Apache config menu.http://myproject.local.phpMyAdmin is the web-based interface for managing your MariaDB databases. After starting MySQL from the Control Panel, click the "Admin" button next to MySQL, or visit http://localhost/phpmyadmin in your browser.
Default MySQL user: root
Default password: (empty / none)
By default, the MySQL root user has no password. For local development this is acceptable, but if you want to set one:
config.inc.php file in phpMyAdmin to match the new password.To import a database, open phpMyAdmin, select your database (or create one), click the "Import" tab, choose your .sql file, and click "Go." To export, select the database, click "Export," choose your format (usually SQL), and click "Go."
The php.ini file controls PHP behavior. Common changes include increasing upload limits, memory limits, and enabling extensions.
PHP (php.ini).upload_max_filesize = 128Mpost_max_size = 128Mmemory_limit = 512Mmax_execution_time = 300Most common extensions are enabled by default. To enable additional ones, open php.ini, find the extension list, and uncomment (remove the semicolon from) the extensions you need. Common extensions include extension=gd, extension=intl, and extension=imap. Restart Apache after making changes.
Port conflicts are the most common issue when starting XAMPP services. Here's how to diagnose and fix them.
Common culprits include Skype, Microsoft IIS, World Wide Web Publishing Service, or another Apache installation.
Another MySQL or MariaDB instance may already be running on your system.
my.ini from 3306 to 3307.Some antivirus and security software may flag XAMPP or its components as suspicious. This happens because XAMPP includes server software that opens network ports and administrative tools that can modify system files - behavior that heuristic scanners sometimes misidentify as malicious.
Important: XAMPP contains no malware, adware, or spyware.
Every release is built from publicly available source code and distributed through trusted channels. If your antivirus flags XAMPP, it is a false positive.
Regularly check for new versions to get security patches, PHP updates, and Apache improvements. Subscribe to the Apache Friends newsletter or monitor the SourceForge project page.
Instead of dumping all projects in htdocs, create a virtual host for each project. This mimics production environments and makes URLs cleaner.
Use phpMyAdmin's export feature regularly to create SQL backups of your databases. Store these backups outside the XAMPP folder in case you need to reinstall.
XAMPP is designed for local development. Default security settings are intentionally minimal. Do not expose XAMPP services to the internet without proper hardening.
If multiple users access your machine, set a MySQL root password and consider enabling authentication for phpMyAdmin via the config.inc.php settings.
When something goes wrong, always check the Apache and MySQL error logs in the Control Panel before searching online. The answer is usually right there.