Avatar of Morgan Jones-King
Morgan Jones-King
 asked on

Updating PHP in Windows Server 2012 r2

Hello,

I currently run PHP 5.5.19 on a windows server 2012 r2 environment with Apache 2.4. I'm trying to update my php version to php 5.6.25. I've replaced the binaries (after creating a backup folder), formatted the .ini, and looked at the httpd.conf. My command line recognizes that php 5.6.25 is the version running, but my apache server won't start.

What am I doing incorrectly?

Thanks in advance!
PHPApache Web ServerWindows Server 2012

Avatar of undefined
Last Comment
Morgan Jones-King

8/22/2022 - Mon
Kimputer

Apache keeps a good error log when it doesn't want to start. Please look into these log files, and if you don't see any, enable it first, then start the service again.
Also enable error logging in the php.ini file, it might provide the correct info to solve this also
Morgan Jones-King

ASKER
Ok, this was in my error log.

[Thu Sep 15 10:48:36.650163 2016] [mpm_winnt:notice] [pid 1908:tid 564] AH00424: Parent: Received restart signal -- Restarting the server.
httpd.exe: Syntax error on line 179 of C:/Apache24/conf/httpd.conf: Cannot load c:/php/php5apache2_4.dll into server: %1 is not a valid Win32 application.

I thought I had downloaded the correct version of PHP. My system type reads: 64-bit operating system, X64-based processor. So I downloaded the php-5.6.25-Win32-VC11-x64 zip file.

Additionally, when I pull up the Apache desktop service monitor the bottom still reads: "Apache/2.4.10 (Win32) PHP/5.5.19"
Dave Baldwin

The new version of PHP should have come with a new version of that DLL.  You can't intermix versions of the files in PHP even though they have the same name.  Make sure the 'httpd.conf' is pointing to the correct file also.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Morgan Jones-King

ASKER
This was the dll that came with the newer version.
Dave Baldwin

I just noticed "Apache/2.4.10 (Win32) PHP/5.5.19" .  You probably should have downloaded the 32-bit TS version of PHP.  Many if not most installs of PHP and Apache on Windows are still 32-bit.  There are versions of WAMP that are 64-bit but the last time I checked, XAMPP is only 32-bit.
Julian Hansen

... and you are definitely running the 64bit version of Apache - because if you are not that is your problem.

The log file is saying that the dll you are pointing to is not a valid Windows binary - and according to your download file name that is the 64bit version of PHP - so I am guessing that Apache is 32 bit - can you confirm?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Morgan Jones-King

ASKER
The apache I'm running is:

httpd-2.4.17-x64-vc11
Dave Baldwin

Then where did you get "Apache/2.4.10 (Win32) PHP/5.5.19" which is a different version?  Also note that the compiler (vc11) must be the same version for both Apache and PHP so that the system and DLL calls work properly.  And of course, you must have the runtime library for that compiler and it must be either 32-bit or 64-bit to match Apache and PHP.
Julian Hansen

Also note that the compiler (vc11) must be the same version for both Apache and PHP so that the system and DLL calls work properly
This is not strictly true. It is not necessary for the compiler versions to match - but it is necessary to have the VC runtimes for both installed - but that should not be an issue because we already know from the opening post that both are running on the system - Apache was there before and PHP runs from the command line which is only possible if the run times were already installed.
For giggles I just built a 2012 VM, loaded the same strain of Apache (httpd-2.4.23-x64-vc11) and the same PHP php-5.6.26-Win32-VC11-x64 - after configuring httpd.conf and php.ini it pretty much worked out of the box. So there is no problem with those two versions working together.
Can you posted your httpd.conf file.
Your help has saved me hundreds of hours of internet surfing.
fblack61
Morgan Jones-King

ASKER
Hi, first of all, it turns out I misspoke on my Apache version. I'm looking aback at my error log to see what the version actually was. It reads: Apache/2.4.10 (Win32), VC11 Server built. My httpd.conf is attached.
httpd.txt
Dave Baldwin

On the Windows Download page for PHP http://windows.php.net/download#php-7.0 , there is info in the left column about the compilers and the libraries that are required along with the Recommended version of Apache.  I believe that you can only have the 32-bit or the 64-bit version of the run-time libraries but not Both.
Dave Baldwin

Note that the Apache Lounge http://www.apachelounge.com/download/ versions are the ones used to build the PHP and other interfaces.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Julian Hansen

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Morgan Jones-King

ASKER
Hi,

My server version is Apache/2.4.10 (Win32). But I'm positive I downloaded and installed the 32 version of PHP: php-5.6.25-Win32-VC11-X64

Is there somewhere to download the .dll specifically in 32 bit?
SOLUTION
Dave Baldwin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Julian Hansen

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Morgan Jones-King

ASKER
Hi all,

Julian, you answered my question! I'd been downloading the php 5.6 - VC11 - X64 instead of x86. Using the x86 did the trick! Everything is working now. Thanks all!
Julian Hansen

You are welcome.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Morgan Jones-King

ASKER
Can you explain the difference between the x64 and x86 version?
Dave Baldwin

Program interfaces for x64 and x86 versions are different.  Specifically, any binary data will be 64-bit or 32-bit.  If you were to pass the wrong size data to a program or DLL, it would not be interpreted correctly.
Julian Hansen

From a functionality perspective they are identical.

The x86 version is compiled to run on 32bit Operating systems
The x64 version is compiled to run on 64bit Operating systems.

However, the x86 will run on both - i.e. you can run the x86 version on a 64bit OS - but not vice versa - X64 won't run on 32bit.

The main difference between the 32 and 64bit is the size of the word - which translates into how much memory you can address. In the case of PHP this is unlikely to make a difference either way.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Morgan Jones-King

ASKER
Thank you!