Jump to content

Recommended Posts

  • ExTS Admin
Posted

To install MySQL and PHP on Windows, you can follow these steps:

Step 1: Install MySQL

  1. Download MySQL Installer:

  2. Run the Installer:

    • Launch the downloaded installer.
    • Choose the "Developer Default" setup type to install MySQL Server and other tools.
  3. Follow the Installation Steps:

    • Accept the license agreement.
    • Choose the MySQL Server version you want to install.
    • Configure the server (set the root password and other options).
    • Complete the installation.
  4. Verify MySQL Installation:

    • Open Command Prompt and type mysql -u root -p to log in to MySQL. Enter the root password you set during installation.

Step 2: Install PHP

  1. Download PHP:

    • Go to the PHP for Windows page.
    • Download the latest Non-Thread Safe (NTS) version of PHP (the zip file).
  2. Extract PHP:

    • Extract the downloaded zip file to a directory (e.g., C:\php).
  3. Configure PHP:

    • Rename php.ini-development to php.ini.
    • Open php.ini in a text editor and configure the necessary settings (like enabling extensions).
  4. Add PHP to the System Path:

    • Right-click on "This PC" or "My Computer" and select "Properties."
    • Click on "Advanced system settings" and then "Environment Variables."
    • Find the "Path" variable in the "System variables" section and click "Edit."
    • Add the path to your PHP directory (e.g., C:\php).
  5. Verify PHP Installation:

    • Open Command Prompt and type php -v to check if PHP is installed correctly.

Step 3: (Optional) Install a Web Server

For PHP to run, you may want to install a web server like Apache or Nginx. Alternatively, you can use XAMPP or WAMP, which bundle Apache, MySQL, and PHP together for easier installation.

Step 4: Test PHP with MySQL

  1. Create a simple PHP file (e.g., test.php) in your web server's root directory with the following content:

    <?php $conn = new mysqli('localhost', 'root', 'your_password', 'your_database'); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } echo "Connected successfully"; ?>
  2. Access this file through your web browser to see if it connects to MySQL successfully.

Conclusion

Following these steps will help you set up MySQL and PHP on your Windows machine. If you encounter any issues, make sure to check the official documentation for MySQL and PHP for troubleshooting tips.


View full article

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...