skip to Main Content

I’m trying to update my PHP version to the brand new PHP 8. I have followed simular steps as this tutorial. But now the following error is shown:

12:06:23  [Apache]  Error: Apache shutdown unexpectedly.
12:06:23  [Apache]  This may be due to a blocked port, missing dependencies, 
12:06:23  [Apache]  improper privileges, a crash, or a shutdown by another method.
12:06:23  [Apache]  Press the Logs button to view error logs and check
12:06:23  [Apache]  the Windows Event Viewer for more clues
12:06:23  [Apache]  If you need more help, copy and post this
12:06:23  [Apache]  entire log window on the forums

Notice: I have used a brand new XAMPP instalation version 7.2.33.

I can’t find the solution for my issue.

Edit
It is saying that I need to look into the Log files hower they are completly empty since it’s a brand new installation.

This is my httpd-xampp.conf:

<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/php8ts.dll"
LoadFile "C:/xampp/php/libpq.dll"
LoadModule php8_module "C:/xampp/php/php8apache2_4.dll"
LoadFile "C:/xampp/php/libsqlite3.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 php8_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 php8_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 php8_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>

6

Answers


  1. Rewriting php8_module to php_module (all occurrences) in

    "httpd-xampp.conf" file solved the Error: Apache shutdown unexpectedly problem for me 🙂

    Login or Signup to reply.
  2. Running PHP 8 on XAMPP is easy now since XAMPP new version released with PHP 8 update. Install XAMPP, and run first PHP program using XAMPP Server on localhost. Following are the steps:

    • Download and Install XAMPP
    • Create a new project in XAMPP and add your PHP program
    • Open XAMPP and run your first PHP program

    Download and Install XAMPP

    Step 1: Go to the Apache Friends website and download XAMPP Server (supporting PHP 8). Apache Friends is the official website to download XAMPP:

    Download XAMPP

    Step 2: After downloading, install it.
    You can install it at any location. We installed XAMPP i.e. C: drive,

    Create a new project in XAMPP

    Step 3: Now, go to htdocs folder in Xampp folder and create your project folder.

    Here, a folder AmitProject created, as in the below screenshot:

    Follow this tutorial and you won’t need to update any settings shown above.

    Login or Signup to reply.
    1. rename old php dir to phpX
    2. Download the needed version of PHP + dev pack, ex.: https://windows.php.net/download#php-8.0
    3. extract to xampp/php the donwloaded archives
    4. if old php configs matters for you, copy phpX/php.ini to php/
    5. extract into xampp, rewrite the referring phpOld lines in httpd-xampp.config
    • Instead of phpX_module, use just php_module
    1. if problem persists, running xampp_start gives PHP load error: %1 is not a valid Win32 application. then also download new apache version…
    • don’t forget to put at thier place the httpd.conf, httpd-ssl.conf, httpd-xampp.conf

    Or instead of downloading the modules separately, just do a new XAMPP installation with the desired version and copy php+apache dirs, then unistall the old one. From the old apache dir get the httpd*.conf files or correct their paths.

    Login or Signup to reply.
  3. This error is the result of an xampp misconfiguration for the new php version (means wrong entries in xampp/apache/conf/extra/httpd-xampp.conf).

    Luckily, you can check the configuration of the apache server with this shell command:

    c:/xampp/apache/bin/httpd.exe -t
    

    (Replace the drive letter with your installation drive letter, also change the xampp folder if you have xampp installed in a custom folder.)

    If you see Syntax OK php should work basically (don’t forget to copy/adjust the php.ini file). If not, the output of httpd.exe -t offer useful hints what should be changed in httpd-xampp.conf.

    Login or Signup to reply.
  4. IN https://windows.php.net/download#php-8.0

    What is very important you have to download the "Thread Safe" version. otherwise you have no "php8apache2_4.dll" and you need that so that php8 works with apache in XAMPP.

    Login or Signup to reply.
  5. I choose this way

    Back up your XAMPP and htdocs files,
    then uninstall XAMPP,
    Download New XAMPP Version,
    Install XAMPP
    configure the path to your back-up htdocs files or Project Files -> httpd.config

    you should find this so that you can customize the path

    DocumentRoot "D:PROJECT"
    <Directory "D:PROJECT">
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search