Updating PHP in Windows Server 2012 r2

Morgan Jones-King
Morgan Jones-King used Ask the Experts™
on
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!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
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

Author

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 Problems
Most Valuable Expert 2014

Commented:
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.
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Author

Commented:
This was the dll that came with the newer version.
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
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.
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
... 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?

Author

Commented:
The apache I'm running is:

httpd-2.4.17-x64-vc11
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
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.
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
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.

Author

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.
httpd.txt
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
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 Problems
Most Valuable Expert 2014

Commented:
Note that the Apache Lounge http://www.apachelounge.com/download/ versions are the ones used to build the PHP and other interfaces.
Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
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.

Author

Commented:
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?
Dave BaldwinFixer of Problems
Most Valuable Expert 2014
Commented:
'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.
Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
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
http://windows.php.net/download#php-5.6-ts-VC11-x86

The thread safe ZIP is the one to go for.

Author

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!
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
You are welcome.

Author

Commented:
Can you explain the difference between the x64 and x86 version?
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
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.
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
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.

Author

Commented:
Thank you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial