Skip to content

Uncategorized

Setting Up PHP Laravel on Windows Server with IIS

Deploying a PHP Laravel application on a Windows Server with IIS involves several steps to ensure the web server handles PHP requests correctly. Here’s a step-by-step guide to get you started with setting up PHP and Laravel on IIS. Step 1: Download PHP for Windows First, download the latest…

· Updated 3 min read

Deploying a PHP Laravel application on a Windows Server with IIS involves several steps to ensure the web server handles PHP requests correctly.

Here’s a step-by-step guide to get you started with setting up PHP and Laravel on IIS.

Step 1: Download PHP for Windows

First, download the latest version of PHP for Windows from the official PHP website .

Choose the “Non-thread-safe” version for better compatibility with IIS FastCGI.

Step 2: Install PHP on the Server

  1. Extract the downloaded PHP files to a directory, for example, C:PHP.
  2. Add C:PHP to your system’s Environment Variables to make PHP globally accessible: — Right-click on This PC and select Properties. — Click Advanced system settings → Environment Variables. — Under System Variables, find Path, click Edit, and add the PHP directory path (C:PHP).
  3. Open Command Prompt and type php -v to verify that PHP is installed and properly configured.

Step 3: Configure IIS for PHP

  1. Open IIS Manager
  2. Create a new site (do not set it up as a sub-application): — Select **Sites **in the left pane and click Add Website. — Point the Physical path to your Laravel application’s folder. — Assign a domain (or use localhost for testing purposes).

Step 4: Install FastCGI for IIS

PHP works with IIS through the FastCGI module, so you need to ensure it’s installed:

  1. Open Server Manager → Add Roles and Features.
  2. In the Features section, make sure **CGI **is installed. If it isn’t, check the box and install it.

Step 5: Set Up Handler Mapping for PHP in IIS

  1. In IIS Manager, select the site you just created.
  2. Under Handler Mappings, click** Add Module Mapping **.
  3. Fill in the form as follows: — Request path: *.php — Module: FastCGI Module — Executable: Path to php-cgi.exe (e.g., C:PHPphp-cgi.exe) — Name: PHP_FastCGI
  4. Click OK, then confirm if prompted.

Step 6: Install IIS Rewrite and CORS Modules

To ensure your Laravel app functions correctly with URL rewriting and CORS, you need to install the** IIS Rewrite** and **CORS **modules: – Download and install the URL Rewrite module and CORS module

Step 7: Configure php.ini

  1. Locate the php.ini file in your C:PHP folder.
  2. Modify the following settings to optimize PHP in your php.ini file

max_execution_time = 90 max_input_time = 90 memory_limit = 4028M post_max_size = 64M

  1. Ensure the following extensions are enabled by uncommenting them or adding them if missing:

extension=curl extension=fileinfo extension=mbstring extension=openssl extension=php_gd.dll extension=D:PHPextphp_mysqli.dll extension=php_sqlsrv_81_nts_x64.dll extension=php_pdo_sqlsrv_81_nts_x64.dll

Note: If you’re using a different version of PHP, replace 81 in the SQL Server drivers with your version number (e.g., 82).

Step 8: Install PHP SQL Server Drivers

Download the appropriate version of the PHP SQL Server drivers from this link for your PHP version (e.g., php_sqlsrv_82_nts_x64.dll for PHP 8.2). 2. Copy the downloaded .dll files to the ext folder inside C:PHP. 3. In php.ini, ensure the SQLSRV and PDO_SQLSRV extensions are enabled:

extension=php_sqlsrv_81_nts_x64.dll extension=php_pdo_sqlsrv_81_nts_x64.dll

Step 9: Restart IIS

After all configurations, restart IIS to apply the changes: – Open Command Prompt as Administrator and run:

iisreset

Step 10: Test the Laravel Application

  1. Navigate to the URL (or localhost) where the application is hosted.
  2. If everything is set up correctly, you should see your Laravel application’s homepage.

Conclusion

By following these steps, you can successfully set up PHP Laravel on a Windows Server with IIS. This setup ensures that Laravel runs efficiently with proper PHP, SQL Server drivers, and IIS FastCGI support. Don’t forget to enable necessary PHP extensions and tweak the php.ini file to match your application’s requirements.

Comments

  • Uncategorized

    Institutional Software Customization: Tailoring Solutions for Your Institution’s Needs

    Introduction: Welcome to the era of customization, where one size doesn’t fit all. In this comprehensive guide, we delve into the intricate world of institutional software customization, unraveling its importance, benefits, and the transformative power it holds for educational and organizational…

    Read article

    Abhilash Sivaraman · 13 Mar 2025 · 3 min read

  • Uncategorized

    Creating a Customer Loyalty Program in Shopify: A Step-By-Step Guide

    Customer loyalty is the difference between success and failure in the cutthroat world of online commerce. One-time customers can become devoted brand supporters with the help of a well-designed customer loyalty programme. One of the top e-commerce platforms, Shopify, provides a comprehensive…

    Read article

    Abhilash Sivaraman · 20 Nov 2024 · 2 min read

  • Uncategorized

    List of Best Startups in Kerala

    List of startups kerala Kerala, often termed “God’s Own Country,” is not just a hub of natural beauty but also a growing hotspot for innovative startups. The state is producing inspiring ventures that combine creativity with technology, driving India’s entrepreneurial spirit forward. Here is a…

    Read article

    Abhilash Sivaraman · 15 Oct 2024 · 2 min read

  • Uncategorized

    Wix for blogging how effective is wix compared to other platforms for our content marketing

    Content marketing remains one of the most effective ways to attract, engage, and convert potential customers online. Whether you’re a small business, startup, freelancer, or established brand, maintaining a blog can significantly improve your website’s visibility and authority. When choosing a…

    Read article

    Abhilash Sivaraman · 22 Aug 2024 · 4 min read

  • Uncategorized

    Building Your Own Native Mobile App with Wix

    Mobile apps have become an essential tool for businesses looking to connect with customers and provide a seamless user experience. With Wix, you can create your own native mobile app without extensive coding knowledge. Why Build a Mobile App with Wix? Wix offers an easy-to-use platform that allows…

    Read article

    Abhilash Sivaraman · 26 Jun 2024 · 1 min read

  • Uncategorized

    Comprehensive Analysis of Leading SMS Gateway Providers in Nigeria

    Top SMS Gateway Providers in Nigeria – In today’s fast-paced digital world, efficient communication is crucial for business success. SMS gateways play a vital role in ensuring that businesses can reach their customers quickly and reliably. In Nigeria, the demand for robust SMS gateway providers…

    Read article

    Abhilash Sivaraman · 1 Feb 2024 · 5 min read

  • Uncategorized

    How to Point Multiple Domains to a Single IIS ASP.net WebForms Project

    Introduction In this blog post, we’ll explore how to configure IIS to point multiple domains to a single WebForms project. This setup is useful for businesses or websites that want to host multiple websites under different domains, but all should point to the same web application or project in…

    Read article

    Abhilash Sivaraman · 25 Jan 2024 · 3 min read

Have a project in mind?

Book a free intro call and let’s talk about your website or web app.