Skip to main content
March 23, 2026Noble Desktop Publishing Team/2 min read

Setting Up: Free PHP & MySQL Tutorial

Master PHP and MySQL development environment setup

Prerequisites Check

Before starting this tutorial, ensure you have downloaded the class files and have either MAMP PRO (Mac) or XAMPP (Windows) installed on your system.

Before diving into the practical exercises ahead, you'll need to complete this essential setup process to ensure your development environment runs smoothly.

Topics Covered in This PHP & MySQL Tutorial:

Setting up Your Class Files, Configuring MAMP PRO to Display Errors for Effective Debugging

Setup Components

Class Files Organization

Learn how to properly structure and place your PHP files in the web server directory for optimal development workflow.

Error Display Configuration

Configure MAMP PRO to show PHP errors during development, making debugging and troubleshooting much easier.

Development Server Options

FeatureMAMP PRO (Mac)XAMPP (Windows)
Installation PathApplications/MAMPC:/xampp
Web Root Directoryhtdocshtdocs
Error Display DefaultHiddenHidden
Recommended: Both servers require manual configuration to display PHP errors during development

Copying the Class Files into the Web Server Folder

Throughout this comprehensive workbook, you'll be working with carefully crafted class files that demonstrate real-world PHP development patterns. These files must reside within your local web server's document root to execute properly—a fundamental requirement that ensures your PHP interpreter can access and process the code.

  1. If you haven't already downloaded the class files for this book, navigate to the Downloading the Class Files chapter for detailed instructions. These files contain production-ready examples you'll modify and extend throughout your learning journey.
  2. Navigate to Desktop > Class Files on your system.
  3. Click once on the phpclass folder to select it—this directory contains all the organized project files and dependencies you'll need.
  4. Press Cmd–C (Mac) or CTRL–C (Windows) to copy the entire folder structure.
  5. Follow the appropriate instructions for your operating system below:

    • Mac users: Navigate to Hard Drive > Applications > MAMP > htdocs
    • Windows users: Navigate to My Computer > C: > xampp > htdocs
  6. Press Cmd–V (Mac) or CTRL–V (Windows) to paste the class files into your web server's document root.

    Your class files are now properly positioned in the root directory of your active web server, making them accessible via your browser at http://localhost/phpclass.

With your files in place, the next crucial step involves configuring your development environment to provide meaningful feedback when issues arise.

File Setup Process

1

Locate Class Files

Navigate to Desktop > Class Files and select the phpclass folder containing all tutorial materials

2

Copy Files

Use Cmd-C (Mac) or Ctrl-C (Windows) to copy the selected phpclass folder to your clipboard

3

Navigate to Web Root

Go to your web server's htdocs directory - either Applications/MAMP/htdocs or C:/xampp/htdocs

4

Paste and Verify

Paste files with Cmd-V (Mac) or Ctrl-V (Windows) into the htdocs directory to make them accessible via web server

Directory Structure Importance

Files must be placed in the web server's root directory (htdocs) to function properly. PHP files outside this directory cannot be executed by the web server.

File Setup Verification

0/3

MAMP PRO: Displaying Errors

By default, MAMP PRO follows production server conventions by suppressing PHP error output—displaying only blank pages when errors occur. While this approach protects production applications from exposing sensitive debugging information, it creates unnecessary obstacles during local development. For efficient coding and debugging, you need immediate, detailed error feedback.

  1. Launch MAMP PRO from your Applications folder.

  2. Click the PHP tab in the main interface to access PHP-specific configuration options.

  3. Locate the Log errors setting at the bottom of the panel, then check the to screen option. This modification enables real-time error display directly in your browser.

  4. Click Save to apply your configuration changes.

  5. When prompted to restart the server, click Yes—this restart ensures your new error handling settings take effect immediately.

Error Display Configuration

1

Launch MAMP PRO

Open the MAMP PRO application to access server configuration settings

2

Access PHP Settings

Click the PHP tab to view and modify PHP-specific configuration options

3

Enable Error Display

Locate 'Log errors' section and check 'to screen' option to display errors in browser

4

Save and Restart

Click Save and restart the server when prompted to apply the new error display settings

Development vs Production

Error display is disabled by default for security reasons in production environments. Always enable it for local development to facilitate debugging and learning.

Error Display Configuration

Pros
Immediate feedback on PHP syntax and runtime errors
Faster debugging and problem identification
Better learning experience for PHP development
Detailed error messages with line numbers and descriptions
Cons
Security risk if accidentally enabled on production servers
May expose sensitive application information
Requires server restart to apply changes

Key Takeaways

1Proper file organization in the web server directory is essential for PHP development workflow
2Class files must be placed in the htdocs directory to be accessible by the web server
3MAMP PRO and XAMPP both use htdocs as their default web root directory
4Error display is disabled by default in development servers for security reasons
5Enabling error display to screen is crucial for effective PHP debugging and learning
6Server restart is required after changing PHP error display configuration
7Different operating systems require different file paths for web server directories
8Development environment setup directly impacts debugging efficiency and learning experience

RELATED ARTICLES