Updating PHP in Windows Server 2012 r2


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!
Morgan Jones-KingAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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-KingAuthor Commented:
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 BaldwinFixer of ProblemsCommented:
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.
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

Morgan Jones-KingAuthor Commented:
This was the dll that came with the newer version.
Dave BaldwinFixer of ProblemsCommented:
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 HansenCommented:
... 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?
Morgan Jones-KingAuthor Commented:
The apache I'm running is:

Dave BaldwinFixer of ProblemsCommented:
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 HansenCommented:
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.
Morgan Jones-KingAuthor Commented:
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.
Dave BaldwinFixer of ProblemsCommented:
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 BaldwinFixer of ProblemsCommented:
Note that the Apache Lounge http://www.apachelounge.com/download/ versions are the ones used to build the PHP and other interfaces.
Julian HansenCommented:
I believe that you can only have the 32-bit or the 64-bit version of the run-time libraries but not Both.
You need the run times to match the compiled application. 32 bit needs 32 bit run times and 64 bit needs 64 bit.
EDIT - to clarify - Windows (64) will (and must) support both 32 and 64 bit - 32 bit installs to  System32 64bit to SysWow64

Apache/2.4.10 (Win32) - looks like the 32 bit version of Apache.

Can you run the following from the bin folder
httpd -v
If it says Win32 then you need the 32 bit version of PHP.
Morgan Jones-KingAuthor Commented:

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?
Dave BaldwinFixer of ProblemsCommented:
'php-5.6.25-Win32-VC11-X64' is 64-bit as shown by the 'x64' at the end.  And the 32-bit version of the DLL will Not work with the 64-bit version of PHP.  You need the VC11 x86 Thread Safe version on http://windows.php.net/download#php-7.0.
Julian HansenCommented:
Is there somewhere to download the .dll specifically in 32 bit?
You want the whole package. This link will take you to the right section

The thread safe ZIP is the one to go for.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Morgan Jones-KingAuthor Commented:
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 HansenCommented:
You are welcome.
Morgan Jones-KingAuthor Commented:
Can you explain the difference between the x64 and x86 version?
Dave BaldwinFixer of ProblemsCommented:
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 HansenCommented:
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.
Morgan Jones-KingAuthor Commented:
Thank you!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.