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.

  • 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

    Content Strategy: How Can We Use a CMS to Better Align Our Content with Business Goals?

    A successful content strategy starts with clear business objectives. Whether your goal is to increase brand awareness, generate leads, or boost sales, a Content Management System (CMS) can help you organize and deliver content more effectively. Define Clear Content Goals Before creating content,…

    Read article

    Abhilash Sivaraman · 26 Oct 2023 · 1 min read

  • Uncategorized

    How to use multiple domains in shopify to power global ecommerce

    Expanding into international markets requires a localized shopping experience. Shopify allows businesses to connect multiple domains to a single store, making it easier to serve customers across different countries and regions. Why Use Multiple Domains? Using multiple domains helps businesses:…

    Read article

    Abhilash Sivaraman · 18 Oct 2023 · 1 min read

Have a project in mind?

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

Request Quote