Page 1 of 1

Error running PHP 5.6 with XAMPP 7.4.16

PostPosted: 16. June 2021 14:23
by ricardouel
Hi friends.

I'm setting up a new PHP version on XAMPP 7.4.16 with PHP 7.4.

The version I need to configure is 5.6.40.

I downloaded the NTS version (non thread safe) and unzipped it in the "C:\xampp\php_5.6" folder.

Renamed and configured "php.ini-development" to "php.ini".

I uncommented the "extension_dir" line
extension_dir="C:\xampp\php_5.6\ext".

I added the following lines to httpd-xampp.conf:

#PHP 5.6 on port 8056
##
ScriptAlias ​​/php_5.6 "C:/xampp/php_5.6"
Action application/x-httpd-php56-cgi /php_5.6/php-cgi.exe
<Directory "C:/xampp/php_5.6">
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-php56-cgi
</FilesMatch>
</VirtualHost>

I'm getting the following error in apache's error.log when I run the code:

<?php
phpinfo();
?>

Error:
[Wed Jun 16 10:01:11.392174 2021] [cgi:error] [pid 8780:tid 2128] [client 192.168.15.10:60851] End of script output before headers: php-cgi.exe

Can anybody help me?

Best regards.

Ricardo.

Re: Error running PHP 5.6 with XAMPP 7.4.16

PostPosted: 16. June 2021 16:22
by Altrea
Why don't you Install XAMPP 5.6.40 which already comes with PHP 5.6.40?
You can find it here: https://sourceforge.net/projects/xampp/ ... ws/5.6.40/

Re: Error running PHP 5.6 with XAMPP 7.4.16

PostPosted: 16. June 2021 17:55
by ricardouel
I already have this infrastructure in PHP 7.4 and other versions of PHP 7.X running perfectly on this XAMPP installation. Now I just need to run PHP 5.6 and I didn't want to have to install 2 versions of XAMPP.

I'm afraid to conflict and ruin what is running perfectly.

Re: Error running PHP 5.6 with XAMPP 7.4.16

PostPosted: 16. June 2021 20:52
by Altrea
Okay.

I have written a step by step tutorial for this in the german part of this board years ago which should still work.
Maybe this can help you: viewtopic.php?f=4&t=67753&p=232615#p232615

Re: Error running PHP 5.6 with XAMPP 7.4.16

PostPosted: 16. June 2021 21:21
by ricardouel
I just didn't understand where I should put the clauses of .htacces. In the application directory I want to run in PHP 5.6?

Re: Error running PHP 5.6 with XAMPP 7.4.16

PostPosted: 16. June 2021 22:26
by Altrea
Yes, you create a .htaccess in the folder which you want to get interpreted by PHP 5.6.40.

It don't need to be a .htaccess, it can also be a virtualhost or Directory section.

Re: Error running PHP 5.6 with XAMPP 7.4.16

PostPosted: 17. June 2021 13:13
by ricardouel
Thanks buddy.

I was able to run PHP 5.6 based on your guidelines as virtual host.

My httpd-xampp.conf was like this:

##
#PHP 5.6 on port 8056
##
ScriptAlias /php_5.6 "C:/xampp/php_5.6"

<IfModule actions_module>
Action application/x-httpd-php56-cgi "/php_5.6/php-cgi.exe"
</IfModule>

<Directory "C:/xampp/php_5.6">
SetEnv PHPRC "C:/xampp/php_5.6"
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-php56-cgi
</FilesMatch>
</VirtualHost>

Best regards.

Ricardo.

Re: Error running PHP 5.6 with XAMPP 7.4.16

PostPosted: 17. June 2021 17:01
by Altrea
great :D
glad you got it working. 8)

Re: Error running PHP 5.6 with XAMPP 7.4.16

PostPosted: 04. April 2024 07:47
by HarryVZ
Old but good :-)
Even nowdays PHP5.6 can be of interrest to run old scripts/apps to not have to redevelop them for PHP7 or PHP8. (only in test-env and for showcases)
I copied PHP5.6 + PHP7.4 from its latest XAMPP packages.

I took your configuration, tried to copy my working PHP74 config, but still had the error:
End of script output before headers: php-cgi.exe


I found a solution to install MS-C++ packages 2008-SP11 and 2012-U4.
I only installed the 2012 C++ package and now PHP5.6.40 is running.

MS-C++ 2012 U4: https://www.microsoft.com/en-us/downloa ... x?id=26368
for reference: https://stackoverflow.com/questions/452 ... hp-version

My config:
Code: Select all
# PHP 56
ScriptAlias /php56 "c:/users/harry/xCode/xampp/php56"
Action application/x-httpd-php56 "/php56/php-cgi.exe"

<Directory "c:/users/harry/xCode/xampp/php56">
    SetEnv PHPRC "c:/users/harry/xCode/xampp/php56"
    AllowOverride None
    Options None
    Require all denied
    <Files "php-cgi.exe">
        Require all granted
    </Files>
</Directory>

Listen 8056
<VirtualHost *:8056>
    <FilesMatch "\.php$">
        #php_flag engine off
        SetHandler application/x-httpd-php56
    </FilesMatch>
</VirtualHost>

# PHP 74
ScriptAlias /php74 "C:/users/harry/xCode/xampp/php74"
Action application/x-httpd-php74 "/php74/php-cgi.exe"

<Directory "C:/users/harry/xCode/xampp/php74">
    SetEnv PHPRC "C:/Users/harry/xCode/xampp/php74"
    AllowOverride None
    Options None
    Require all denied
    <Files "php-cgi.exe">
        Require all granted
    </Files>
</Directory>

Listen 8074
<VirtualHost *:8074>
    <FilesMatch "\.php$">
        #php_flag engine off
        SetHandler application/x-httpd-php74
    </FilesMatch>
</VirtualHost>


Thank you both. :-)