skip to Main Content

I have php 7.4 by default in my xampp (in the path c:xamppphp) and my most projects are running on it.Now, I’ve a php 8 project & so need to run xampp with php 8.1 on a different port(8056).I tried doing it with the answer mentioned in this link:

How to use Multiple xampp Like xampp php version 5, xampp php version 7, version 8. I also install it but problem new laravel project npm not install

Although the new port (8056) is also getting listed under ports in Xampp control panel, not able to load xampp with it.When running http://localhost:8056/ , am getting the error:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at postmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Apache/2.4.52 (Win64) OpenSSL/1.1.1m PHP/7.4.27 Server at localhost Port 8056

In the last line of this error,it seems it is still running on php.7.4 . I wanted only php 8.1 to listen on this port. How can I fix this? Any help is much appreciated.

Steps I did:

1.downloaded php 8(non thread safe version) & extracted file to the path c:xamppphp8

2.As the php.ini file does not exists in the path c:xamppphp8, created a new text file & named it php.ini.Copied the contents in php.ini-development to php.ini and uncommented the line

extension_dir = "ext"

3.Added content mentioned in step 3 & step 4- option 2 with only modifications for the php version name as below.Below given is the full content of my current xampp – Apache config file (httpd-xampp.conf)

#
# XAMPP settings
#

<IfModule env_module>
    SetEnv MIBDIRS "C:/xampp/php/extras/mibs"
    SetEnv MYSQL_HOME "\xampp\mysql\bin"
    SetEnv OPENSSL_CONF "C:/xampp/apache/bin/openssl.cnf"
    SetEnv PHP_PEAR_SYSCONF_DIR "\xampp\php"
    SetEnv PHPRC "\xampp\php"
    SetEnv TMP "\xampp\tmp"
</IfModule>

#
# PHP-Module setup
#
LoadFile "C:/xampp/php/php7ts.dll"
LoadFile "C:/xampp/php/libpq.dll"
LoadFile "C:/xampp/php/libsqlite3.dll"
LoadModule php7_module "C:/xampp/php/php7apache2_4.dll"

<FilesMatch ".php$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch ".phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>

#
# 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 php7_module>
    PHPINIDir "C:/xampp/php"
</IfModule>

<IfModule mime_module>
    AddType text/html .php .phps
</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>

<Directory "C:/xampp/htdocs/xampp">
    <IfModule php7_module>
        <Files "status.php">
            php_admin_flag safe_mode off
        </Files>
    </IfModule>
    AllowOverride AuthConfig
</Directory>

<IfModule alias_module>
    Alias /licenses "C:/xampp/licenses/"
    <Directory "C:/xampp/licenses">
        Options +Indexes
        <IfModule autoindex_color_module>
            DirectoryIndexTextColor  "#000000"
            DirectoryIndexBGColor "#f8e8a0"
            DirectoryIndexLinkColor "#bb3902"
            DirectoryIndexVLinkColor "#bb3902"
            DirectoryIndexALinkColor "#bb3902"
        </IfModule>
        Require local
        ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
   </Directory>

    Alias /phpmyadmin "C:/xampp/phpMyAdmin/"
    <Directory "C:/xampp/phpMyAdmin">
        AllowOverride AuthConfig
        Require local
        ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
    </Directory>

    Alias /webalizer "C:/xampp/webalizer/"
    <Directory "C:/xampp/webalizer">
        <IfModule php7_module>
            <Files "webalizer.php">
                php_admin_flag safe_mode off
            </Files>
        </IfModule>
        AllowOverride AuthConfig
        Require local
        ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
    </Directory>
</IfModule>

ScriptAlias /php8 "C:/xampp/php8"
Action application/x-httpd-php8-cgi /php8/php-cgi.exe
<Directory "C:/xampp/php8">
    AllowOverride None
    Options None
    Require all denied
    <Files "php-cgi.exe">
        Require all granted
    </Files>
</Directory>

Listen 8056
<VirtualHost *:8056>
    <FilesMatch ".php$">
        SetHandler application/x-httpd-php8-cgi
    </FilesMatch>
</VirtualHost>
  1. saved its contents & restarted xampp & apache.

2

Answers


  1. I used XAMPP and had ran into the same issue. I have since moved to Laragon and it makes using different versions of PHP & MySQL simple.

    Check it out: Laragon

    Login or Signup to reply.
  2. i agree laragon is best for windows not sure if you can use multiple php on xamp without installing it in different folders

    maybe this works

    Is there way to use two PHP versions in XAMPP?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search