PHP and MySQL with XAMPP
Site Designer works with static HTML by default, but it also supports PHP files. If your project needs server-side processing — a contact form, dynamic content from a database, or PHP templates — you can use XAMPP to run a local server on your computer and test PHP pages directly in Site Designer’s Live Preview.
What is XAMPP?
XAMPP is a free, open-source local server stack that runs on Windows and macOS. It includes:
- Apache — the web server (handles HTTP requests)
- MySQL / MariaDB — the database server
- PHP — the scripting language for dynamic pages
- phpMyAdmin — a web interface for managing your database
XAMPP lets you replicate a live web hosting environment on your own machine, with no internet connection required.
Setting up XAMPP
-
Download and install XAMPP
Go to apachefriends.org and download the installer for your OS. Run it and accept the defaults. XAMPP installs to
C:\xampp\on Windows and/Applications/XAMPP/on macOS. -
Start Apache and MySQL
Open the XAMPP Control Panel and click Start next to both Apache and MySQL. Both status indicators should turn green.
-
Place your project in htdocs
XAMPP serves files from its
htdocsfolder (C:\xampp\htdocs\on Windows,/Applications/XAMPP/htdocs/on macOS). Create a subfolder for your project (e.g.,htdocs/mysite/) and set it as your Site Designer export directory (see Configuring the export directory).
Using Live Preview with PHP
Site Designer’s Live Preview auto-detects .php files in your project. When a page has a .php extension:
- Live Preview opens the page through Apache’s local URL (
http://localhost/mysite/page.php) rather than a file URL. - Apache processes any PHP code in the file before sending it to the browser — exactly as a live server would.
- You see the rendered output, not the raw PHP source.
PHP for contact forms
A common use case is a contact form that emails the submitted data. The form HTML is built visually in Site Designer; the PHP processing logic is added via Page Settings → Head/Body Code or as a separate process.php page. Site Designer preserves any PHP tags it finds in your files and exports them exactly as-is.
MySQL for dynamic content
For projects that need a database — a portfolio with database-driven project listings, a blog, a simple CMS — you connect to MySQL from your PHP pages using PDO or mysqli. XAMPP’s phpMyAdmin (available at http://localhost/phpmyadmin) lets you create databases and tables without writing raw SQL.
Site Designer does not manage database connections itself — that logic lives in your PHP files. Site Designer’s role is to build the HTML/CSS structure and export it; the PHP and SQL are yours to write.
Exporting PHP projects
When you export a project that includes PHP pages, Site Designer exports .php files with all your PHP code intact. Upload these files to your PHP-capable web host via FTP and they will work the same way they did in your XAMPP local environment — provided your production database credentials are configured correctly.