User Tools

Site Tools


run_litecart_xampp

Run LiteCart on XAMPP

XAMPP comes preconfigured with one version of PHP running via CGI. To download and install XAMPP visit the official website of Apache Friends.

XAMPP is preconfigured to display websites in the htdocs directory. To install LiteCart simply download the Web Installation file and put it in a new directory under htdocs e.g. c:\xampp\htdocs\litecart\.

Navigate to http://localhost/litecart/ 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:

C:\Windows\Systemapache\conf\vhosts\myhostname.conf
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
<VirtualHost *:80>
  ServerName litecart.local
  DocumentRoot "X:\Path\To\LiteCart\public_html"
  <Directory "X:\Path\To\LiteCart\public_html">
    Options Indexes FollowSymLinks Includes ExecCGI
    DirectoryIndex index.php index.html
    AllowOverride All
 
    <IfModule mod_authz_core.c>
      <RequireAny>
        Require ip 127.0.0.1
        Require ip ::1
      </RequireAny>
    </IfModule>
 
  </Directory>
</VirtualHost>

3. Restart Apache and navigate to your new domain http://litecart.local/.

Run PHP via FastCGI instead of CGI

1. Download FastCGI from Apache Downloads. 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
    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"
 
#
# PHP-CGI setup
#
#<FilesMatch "\.php$">
#    SetHandler application/x-httpd-php-cgi
#</FilesMatch>
#<IfModule actions_module>
#    Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
#</IfModule>
 
<IfModule php_module>
    PHPINIDir "C:/xampp/php"
</IfModule>
 
ScriptAlias /php-cgi/ "C:/xampp/php/"
<Directory "C:/xampp/php">
    AllowOverride None
    Options None
    Require all denied
    <Files "php-cgi.exe">
          Require all granted
    </Files>
</Directory>
 
<Directory "C:/xampp/cgi-bin">
    <FilesMatch "\.php$">
        SetHandler cgi-script
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler None
    </FilesMatch>
</Directory>

3. Insert this new configuration directive:

c:\xampp\apache\conf\extra\httpd-xampp.conf
# Load FastCGI module
LoadModule fcgid_module modules/mod_fcgid.so
 
# Default PHP FastCGI Configuration
<IfModule fcgid_module>
    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
 
    <Files ~ "\.php$>"
      Options +ExecCGI
      AddHandler fcgid-script .php
      FcgidWrapper "c:/xampp/php81/php-cgi.exe" .php
    </Files>
</IfModule>

4. Restart your webserver and make sure everything is fine. PHP info should display Server API: CGI/FastCGI.

Run separate versions of PHP via FastCGI on separate domains

1. Rename the directory C:\xampp\php to the the corresponding version e.g. php81. Don't forget to update the paths in c:\xampp\apache\conf\extra\httpd-xampp.conf.

2. Go to windows.php.net and download any additional PHP versions in folders like c:\xampp\php74, c:\xampp\php80, etc. We use the thread safe versions.

3. Make sure all c:\xampp/php*/ folders have a configuration file php.ini. First time users copy php.ini-production to php.ini.

4. Edit all configuration files c:\xampp/php*/php.ini. Set the extension directory to ext.

c:\xamp\php81\php.ini
extension_dir = ext

5. Open Notepad as an administrator and add new domains to your Windows hosts file:

C:\Windows\Systemapache\conf\vhosts\myhostname.conf
127.0.0.1	php80.litecart.local
127.0.0.1	php81.litecart.local

6. Add the following directives to your virtualhost configuration:

C:\xampp\apache\conf\extra\httpd-vhosts.conf
<VirtualHost *:80>
  ServerName php81.litecart.local
 
  DocumentRoot "X:\Path\To\LiteCart\public_html"
  <Directory "X:\Path\To\LiteCart\public_html">
    DirectoryIndex index.php
    AllowOverride All
 
    <RequireAny>
      Require ip 127.0.0.1
      Require ip ::1
    </RequireAny>
  </Directory>
 
  <Files ~ "\.php$>"
    #FcgidInitialEnv PHPRC "c:/xampp/php80/php.ini" #Uncomment for custom php.ini
    FcgidWrapper "c:/xampp/php80/php-cgi.exe" .php
  </Files>
</VirtualHost>
C:\xampp\apache\conf\extra\httpd-vhosts.conf
<VirtualHost *:80>
  ServerName php81.litecart.local
 
  DocumentRoot "X:\Path\To\LiteCart\public_html"
  <Directory "X:\Path\To\LiteCart\public_html">
    DirectoryIndex index.php
    AllowOverride All
 
    <RequireAny>
      Require ip 127.0.0.1
      Require ip ::1
    </RequireAny>
  </Directory>
 
  <Files ~ "\.php$>"
    #FcgidInitialEnv PHPRC "c:/xampp/php81/php.ini" #Uncomment for custom php.ini
    FcgidWrapper "c:/xampp/php81/php-cgi.exe" .php
  </Files>
</VirtualHost>

7. Restart your Apache webserver.

Your two new domains http://php80.litecart.local/ and http://php81.litecart.local/ should be running separate PHP versions.

run_litecart_xampp.txt · Last modified: 2022/06/27 01:13 by tim