PHP Installation

To install PHP, follow these general steps depending on your operating system:


Windows Installation

Using XAMPP (Recommended for beginners):

  1. Download XAMPP from: https://www.apachefriends.org/

  2. Run the installer and select Apache and PHP components.

  3. Launch the XAMPP Control Panel and start Apache.

  4. Place your PHP files in the htdocs folder inside the XAMPP directory.

  5. Access your PHP files in a browser at: http://localhost/filename.php

Manual PHP Installation (Advanced):

  1. Download PHP from: https://windows.php.net/download/

  2. Extract the files to C:\php

  3. Add C:\php to the Windows PATH variable.

  4. Configure php.ini (copy and rename php.ini-development to php.ini)

  5. Optionally configure Apache or use PHP’s built-in server:

    bash
    php -S localhost:8000

Linux Installation (Ubuntu/Debian)

sudo apt update sudo apt install php libapache2-mod-php php-mysql
  • Check version:

    php -v
  • To run a file:

    php filename.php

macOS Installation

Using Homebrew:

  1. Install Homebrew if you haven’t:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Install PHP:

    brew install php
  3. Check version:

    php -v
  4. Start PHP’s built-in server:

    php -S localhost:8000

Would you like help verifying the installation or setting up a devel