I wanted to install Apache and PHP without using xampp. Apache is working fine. When i type localhost in my browser it shows "It works!" but when i try to install PHP, i get always this error:
"apache 2.2.4 cannot load php5apache2_4.dll into server: %1 is not a Win32-executable" (or something like this. Ive got a german version of the error)
I have windows 7 64bit. I re and installed multiple times but nothing changed.
In my config i have this.
LoadModule php5_module "c:/php-5/php5apache2_4.dll"
Got anyone an idea?
Apache Version is 2.2.4 and Php5.6
I used to have the same probleme so I switch to a Virtual Machine on Unix. My Probleme was here :
http://windows.php.net/download/
Apache Please use the Apache builds provided by Apache Lounge. They
also provide VC11 builds of Apache for x86 and x64. We use their
binaries to build the Apache SAPIs.
If you are using PHP with Apache 1 or Apache2 from apache.org (not
recommended) you need to use the older VC6 versions of PHP compiled
with the legacy Visual Studio 6 compiler. Do NOT use VC9+ versions of
PHP with the apache.org binaries.
With Apache you have to use the Thread Safe (TS) versions of PHP.
I wanted to post this as a comment but it was to long.
Related
[EVERYTHING WORKS NOW!]
MY SOLUTION:
The first mistake i made, was simply, that i had some random 32bit version of PHP installed, and some random 64bit version of Apache! After that, i just downloaded the latest version of PHP, and put it in my c:\php folder, THEN downloaded the LATEST version of the VC14 version of Apache, from the apachelounge website (VC14 category on the left side on the website). And the last mistake was, that i had the W3SVC from IIS still running, so i stopped that one under services (search in windows for services.msc)! And yeah, thats it, all solved now!
So, i have a problem, i installed Apache recently, and set up a working webserver!
This all worked fine, my whole website works flawlessly, and its fully usable!
BUT, all of my php scripts did NOT work, when loading one on the website, apache just show the entire source code of the .php file, instead of displaying it like an html page!
So, i noticed, i do not have PHP configured with my apache server!
What i then did, was download php, put it in c:\php, configure the php.ini, and all of that works, i know because in IIS 10, my website worked perfectly fine with PHP!
so i installed php, for apache 2.4, the VS11 version, the same goes for apache, (i did that because the latest versions of both did not work for me, i had the same problem)!
and as soon as i do the last step,
add these lines to my httpd.conf (inside my apache folder):
LoadModule php5_module "c:/php/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir " C:/php"
, when i want to start the apache server, it just tells me this:
"The requested operation has failed."
(this happens when i select the service of my server in the Apache-Monitor, and click on "start)
(NO error log is beeing created from apache, nothing inside the error nor log folder (both configure in the httpd.conf))
only CMD gives me the following erro:
httpd: Syntax error on line 533 of C:/Apache24/conf/httpd.conf: Cannot
load c:/php/php5apache2_4.dll into server: %1 is not a valid Win32
application.
Now, as soon as i remove these 3 lines from my httpd.conf, the server works perfectly fine again, can be started, and the website is usable, except, all php pages do not work(of course).
i heard something about a "libphp5.so", i do not know if it has anything to do with neither my apache server, nor my whole problem, but i don't know, atleast i have no such thing in my "C:\Apache24" folder!
SOME INFORMATION THAT MIGHT BE IMPORTANT:
All this is hosted from a normal PC (Windows 10) (64 Bit), 32GB RAM, 8x4GHz processor etc..!
yes, i have added c:\php to my Path environment variable! (as said before, all is working if i do not add these lines, which according to google results, are necessary to get php to work with apache)!
If anyone knows what to do, id be so glad, because i do not want to keep using IIS (its good but..), as i could do definitely more with Apache!
Read the manual carefully. Reinstall apache and use PHP 5.6. unless you are ready to fix issues that come with PHP 7.1. Notice Do NOT use VC11+ versions of PHP with the apache.org binaries. This is taken from PHP.net
Apache:
Please use the Apache builds provided by Apache Lounge. They
provide VC11, VC14 and VC15 builds of Apache for x86 and x64. We use
their binaries to build the Apache SAPIs.
If you are using PHP as module with Apache builds from apache.org (not
recommended) you need to use the older VC6 versions of PHP compiled
with the legacy Visual Studio 6 compiler. Do NOT use VC11+ versions of
PHP with the apache.org binaries.
With Apache you have to use the Thread Safe (TS) versions of PHP.
VC11, VC14 & VC15 More recent versions of PHP are built with VC11,
VC14 or VC15 (Visual Studio 2012, 2015 or 2017 compiler respectively)
and include improvements in performance and stability.
The VC11 builds require to have the Visual C++ Redistributable for Visual Studio 2012 x86 or x64 installed
The VC14 builds require to have the Visual C++ Redistributable for Visual Studio 2015 x86 or x64 installed
The VC15 builds require to have the Visual C++ Redistributable for Visual Studio 2017 x64 or x86 installed
TS and NTS TS refers to multithread capable builds. NTS refers to
single thread only builds. Use case for TS binaries involves
interaction with a multithreaded SAPI and PHP loaded as a module into
a web server. For NTS binaries the widespread use case is interaction
with a web server through the FastCGI protocol, utilizing no
multithreading (but also for example CLI).
Source: PHP.NET Manual
Make sure Apache2 and PHP binaries have the same:
Visual Studio C++ binary compatibility version
(Visual Studio C++ 2015 = VC14, Visual Studio C++ 2017 = VC15)
system architecture: 32bit(win32) / 64bit(win64)
for example:
php-7.3.15RC1-Win32-VC15-x86
be sure u have:
httpd-2.4.41-win32-VC15
best place to download Apache 2 binaries for Windows is Apache Lounge
(on Top Left corner you control the VC version):
https://www.apachelounge.com/download/VC15/
and to download PHP binaries also mind that with Apache you have to use the Thread Safe (TS) versions of PHP. go here:
https://windows.php.net/qa/
do not forget to add (System Variables) PATH for php,
open cmd As Administrator and type:
setx path "%PATH%, C:\php73" /M
I am trying to run PHP 5.6 on Apache 2.4. I installed Apache 2.4 as a service on Windows Server 2012.
I downloaded and installed Apache 2.4.20 Win64. Then I downloaded php 5.6.23 VC11 x86 Non Thread Safe binaries
The last step that is needed to load php module in Appache to use php.
LoadModule php5_module "c:/php/php5apache2_4.dll"
The problem is that the file php5apache2_4.dll is not found with the php binaries.
What is the correct file that I should use to load php5_module
here is a list of the content of the php binaries
Any specific reason you got the non-thread-safe (NTS) version? The NTS version does not include the Apache module on purpose.
Anyways, you can download the thread-safe (TS) version and put the DLL into your NTS PHP folder. I've never tried this so you might just get more errors. The NTS version is meant for FastCGI environments.
If you have no rhyme or reason for picking NTS then just get the TS version.
Please read the Choose Build section of http://php.net/manual/en/install.windows.manual.php
Iam try to install (switch) PHP v5.1.6 with last version of Wamp, but a console message says: "This PHP version doesn't seem to be compatible with your actual Apache Version. Switch cancelled..."
How I can know the apache version compatible with the php version indicated (5.1.6)? What is the procedure to downgrade the version current version of apache?
THX
PHP5.1.anything will not run with Apache 2.4.anything.
If you look in the PHP5.1.6 folder you will NOT see a php5apache2_4.dll, which is PHP for that version compiled as a DLL with linkages to Apache 2.4, all you will see is a php5apache2_2.dll i.e. that version of PHP compiled with Apache 2.2 linkages. Its possible that version of PHP only has linkages for Apache 2.0, in which case it could be a real pain trying to get it working.
So you will also have to install a Apache2.2 or maybe Apache 2.0 that will run with it.
Both Apache and PHP will need to be compiled with the same compiler, probably VC6, as I think PHP5.1 was almost definitely compiled with VC6.
You may also find it useful to install another version of PHP like PHP5.3.29 maybe as this will run under Apache 2.2 and Apache 2.4, then when you are switching versions you can step backwards like so :-
While running Apache2.4 and PHP 5.4.16
Switch to PHP 5.3.29
Then switch to Apache 2.2.?
Then switch from PHP 5.3.29 to 5.1.6
This assumes PHP5.1.6 runs with Apache 2.2 and does not need the extra steps to ge back to Apache 2.0
You may also need other PHP's or Apache's I am not absolutely sure as its a long ways back from PHP5.4 to PHP5.1, but I hope this gives you a bit of an idea what might be involved.
Alternatively you could backup your current WAMPServer and uninstall it, and install an old version of WAMPServer 2.2a/b/c/d/e... You will have to try a few to see if they go back that far
I'm trying to integrate php on Apache. Following is the versions I'm using
Apache 2.4 (httpd-2.0.64-win32-x86-openssl-0.9.8o)
PHP (php-5.5.0-Win32-VC11-x64.zip)
I'm setting this on a 64 bit windows 7 machine. I have made the configurations as per this, but I'm getting the following error even though I have place the dll in the specified folder.
Cannot load C:/php/php5apache2_4.dll into server: The specified
module could not be found.
The httpd.conf line entry is this
LoadModule php5_module "C:/php/php5apache2_4.dll"
Is there any version compatible issues?
The only way I've been able to get PHP (5.5) to work with Apache (2.4) on Windows (7 and 8) is to make sure Apache and PHP are both either 32-bit (x86) or 64-bit (x64) and that Apache and PHP are both Thread Safe (TS). Using Non-Thread Safe (NTS) did not work for me (or others), and the Thread Safe build comes bundled with the needed Apache Module for PHP "php5apache2_4.dll". Once all my bit-depths and thread safety was matched up, Apache 2.4 and PHP 5.5 work well together on my Windows systems.
Both products must also have been compiled using the same major versions of Microsoft Visual Studio/C++, such as VC6 (the legacy VC++ compiler), VC9=Studio 2008, or VC11=Studio 2012. For the above Apache versions, only VC9 or VC11 are commonly used.
Links:
Get Windows Apache binaries here:
http://www.apachelounge.com/download/
Get Windows PHP binaries here:
http://windows.php.net/download/
Install the Visual C++ Redistributable compiler runtime library for the specific Visual Studio version used to prepare both Apache and PHP for Windows:
2012: http://www.microsoft.com/en-us/download/details.aspx?id=30679
2008: http://www.microsoft.com/en-us/download/details.aspx?id=5582
You are right Marty, they work only if both are either 32bit or 64 bit. I used XAMPP- Apache's distributed installation to resolve this issue.
Apache win 32 with 64 bits its the problem, you need Apache64
When I try to start Apache with
[PHP_APC]
extension = php_apc.dll
[apc]
apc.shm_segments=1
apc.optimization=0
apc.shm_size=128
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.enable_cli=1
in php.ini, it fails. I have the php_apc.dll in the ext directory.
Using Apache 2.2.17 and PHP 5.2.14 on Windows 7 x64.
Any suggestions?
After trying a lot of solutions, I found one that worked for me... so I am going to post this as an answer just to help people that may have the same problem finding the correct version to use.
I am using Windows 7 32bits, PHP 5.3.13, Apache 2.2.22, and the php_apc.dll found in the file apc-igbinary-fastlz-snap20110301-5.3-ts-vc9-x86.zip in this site: http://downloads.php.net/pierre/
I have registered the extension by just pasting the following code to the end of php.ini file:
[PHP_APC]
extension=php_apc.dll
Then I checked the result of phpinfo(), by using this php file:
phpinfo.php
<?php phpinfo(); ?>
Best bet, due to the limited windows PECL support atm, is to install Zend Server CE w/ PHP 5.3. You can have it install itself on IIS or Apache on the windows machine. Zend Server comes with APC built in (As well as many other PHP modules missing from the current 5.3 PECL stack).
As a side note, you could probably (I haven't tested this so...is just a possibility) install the server, "steal" the dlls, and install PHP however you like w/o zend server. BUT, that said, Zend server is actually pretty nice :)
Fixed. Was using the wrong version of APC.
when on Windows use APC VC6 from here
http://downloads.php.net/pierre