Setup a Web Server Using XAMPP

XAMPP is a free Apache distribution containing MariaDB, PHP, and Perl.

  1. Download and install XAMPP from the official website of Apache Friends. You can also install XAMPP via a Windows Terminal command: winget install ApacheFriends.Xampp.8.2

  2. After installation make sure that you have enabled all necessary PHP extensions in


extension=intl extension=mbstring extension=exif extension=mysqli
extension=openssl extension=zip 

3. Start Apache from your XAMPP control panel (or restart the service
if it's already started for changes to have effect).

# Install LiteCart on XAMPP

XAMPP is preconfigured to display websites placed in the htdocs
directory. To install LiteCart simply download the [Web Installation](https://github.com/litecart/installer/tree/master/web)
file and put it in a new directory under htdocs e.g.
*c:\xampp\htdocs\litecart\*.

Navigate to ** to complete the installation.

# Dedicate a Hostname For Your LiteCart Installation

1. Open Notepad as an administrator and add your domain to your Windows
hosts file:

```conf C:\Windows\System32\drivers\etc\hosts 127.0.0.1
litecart.local 

2. In the configuration file
C:\xampp\apache\conf\extra\httpd-vhosts.conf. Add a new virtualhost
directive:

**C:\xampp\apache\conf\extra\httpd-vhosts.conf:**
```conf

 ServerName litecart.local
 DocumentRoot "X:\Path\To\LiteCart\public_html"

   Options Indexes FollowSymLinks Includes ExecCGI
   DirectoryIndex index.php index.html
   AllowOverride All

       Require ip 127.0.0.1
       Require ip ::1

3. Restart Apache and navigate to your new domain
.

# Run PHP via FastCGI instead of CGI

1. Download FastCGI from [Apache Downloads](https://httpd.apache.org/download.cgi). Copy the
file *mod_fcgid.so* from the downloaded ZIP archive to the directory
*c:\xampp\apache\modules\*.

2. Edit *c:\xampp\apache\conf\extra\httpd-xampp.conf* and
**remove** the following lines:

**c:\xampp\apache\conf\extra\httpd-xampp.conf:**
```conf

   SetEnv MIBDIRS "C:/xampp/php/extras/mibs"
   SetEnv PHP_PEAR_SYSCONF_DIR "\xampp\php"
   SetEnv PHPRC "\xampp\php"

LoadFile "C:/xampp/php/php8ts.dll" LoadFile "C:/xampp/php/libpq.dll"
LoadFile "C:/xampp/php/libsqlite3.dll" LoadModule php_module
"C:/xampp/php/php8apache2_4.dll"

# 
2. PHP-CGI setup
3.  
4.  
5.  SetHandler application/x-httpd-php-cgi
6.  
7.  
8.  Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
9.  

   PHPINIDir "C:/xampp/php"

ScriptAlias /php-cgi/ "C:/xampp/php/" 

   AllowOverride None
   Options None
   Require all denied

         Require all granted

       SetHandler cgi-script

       SetHandler None

3. Insert this new configuration directive:

**c:\xampp\apache\conf\extra\httpd-xampp.conf:**
```conf

# Load FastCGI module

LoadModule fcgid_module modules/mod_fcgid.so

# Default PHP FastCGI Configuration

   FcgidInitialEnv PATH "c:/xampp/php81;C:/WINDOWS;C:/WINDOWS/system32;"
   FcgidInitialEnv SystemRoot "C:/Windows"
   FcgidInitialEnv SystemDrive "C:"
   FcgidInitialEnv TEMP "C:/WINDOWS/Temp"
   FcgidInitialEnv TMP "C:/WINDOWS/Temp"
   FcgidInitialEnv windir "C:/WINDOWS"
   FcgidIOTimeout 64
   FcgidConnectTimeout 16
   FcgidMaxRequestsPerProcess 1000
   FcgidMaxProcesses 50
   FcgidMaxRequestLen 8131072

   #FcgidInitialEnv PHPRC "c:/xampp/php81/php.ini" #Uncomment for custom php.ini
   FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000

Revisions

Recently Edited Articles