Error running PHP 5.6 with XAMPP 7.4.16

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Error running PHP 5.6 with XAMPP 7.4.16

Postby ricardouel » 16. June 2021 14:23

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.
ricardouel
 
Posts: 14
Joined: 24. March 2021 19:11
XAMPP version: 7.4.16
Operating System: Windows 8

Re: Error running PHP 5.6 with XAMPP 7.4.16

Postby Altrea » 16. June 2021 16:22

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/
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Error running PHP 5.6 with XAMPP 7.4.16

Postby ricardouel » 16. June 2021 17:55

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.
ricardouel
 
Posts: 14
Joined: 24. March 2021 19:11
XAMPP version: 7.4.16
Operating System: Windows 8

Re: Error running PHP 5.6 with XAMPP 7.4.16

Postby Altrea » 16. June 2021 20:52

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
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Error running PHP 5.6 with XAMPP 7.4.16

Postby ricardouel » 16. June 2021 21:21

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?
ricardouel
 
Posts: 14
Joined: 24. March 2021 19:11
XAMPP version: 7.4.16
Operating System: Windows 8

Re: Error running PHP 5.6 with XAMPP 7.4.16

Postby Altrea » 16. June 2021 22:26

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.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Error running PHP 5.6 with XAMPP 7.4.16

Postby ricardouel » 17. June 2021 13:13

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.
ricardouel
 
Posts: 14
Joined: 24. March 2021 19:11
XAMPP version: 7.4.16
Operating System: Windows 8

Re: Error running PHP 5.6 with XAMPP 7.4.16

Postby Altrea » 17. June 2021 17:01

great :D
glad you got it working. 8)
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Error running PHP 5.6 with XAMPP 7.4.16

Postby HarryVZ » 04. April 2024 07:47

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. :-)
WindowsXP, MacOS X, Windows11 - ApacheFriends since 2002 :-)
HarryVZ
 
Posts: 20
Joined: 13. October 2009 17:20
Location: Netherlands + Austria
XAMPP version: 8.2.12
Operating System: Windows 11


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 86 guests