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
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'm unable to make ioncube encoder work with Apache 2.4.12 and PHP 5.5.8. So, this is what I've done by now:
1. Installed httpd-2.4.12-win32-VC11 [http://www.apachelounge.com/download/]
2. Installed php-5.5.8-Win32-VC11-x64.zip [http://windows.php.net/downloads/releases/archives/]
Their raw combination works ok - I can run php scripts etc. I then:
3. Installed ioncube for Windows VC11 (64 bits) [https://www.ioncube.com/loaders.php]
I made corrections to php.ini and when I do php -m I see that it loads ioncube extension without any errors. However, when I now start Apache I get an error with a message about zend_get_hash_value and php5ts.dll. (PS. Combination with Apache 2.2, PHP 5.4 and ioncube works for me, but it seems rather outdated).
It seems like you have mismatched the thread-safe version of Apache and the ionCube Loader. PHP extensions have to match exactly the version that they run on, that is PHP with thread-safety enabled has to have a thread-safe Loader.
To confirm this, go to the output of your phpinfo(); and look for the entry Thread Safety. If it says disabled, make sure you have the Non-TS version of the ionCube Loader (Win x64 Non-TS zip). Likewise, if it says enabled, make sure you have to thread-safe version of the Loader (Win x64 TS zip).
Furthermore, please consider using 32bit PHP / Apache on Windows, as PHP 64bit is still marked as experimental and can cause issues with the ionCube Loader:
The x64 builds of PHP for Windows should be considered experimental, and do not yet provide 64-bit integer or large file support (source)
I am using magic library to change the resolution of the images. But I am getting following error when I am running the Wamp.
I am also sharing links of the website I have followed.
Link
http://www.zoharbabin.com/5-steps-to-get-imagemagick-on-xampp-1-7-3/
These are step by step instructions on how to get ImageMagick running under PHP in a Windows environment. Apache does not provide binaries for Windows and relies upon several sources to do so:
XAMPP
WampServer
Apache Lounge
Bitnami
Apache Haus
It is recommended to download either the XAMPP or WampServer distributions as they are complete packages that contain Apache HTTP server, PHP and MySql known and tested to work together.
Making ImageMagick work was not easy for me. It took two days of trial and error to get this to work. Hopefully this will help you get up and running faster. I have this running on the following:
Windows 7 Home Edition 64-bit
XAMPP 5.6.3
Apache HTTP 2.4.10 (Win32), VC 11
PHP 5.6.3 x86 VC 11, Thread safe
Thus, a 32-bit web framework compiled with VC 11 and thread safety enabled all running on 64-bit Windows 7. You must choose a 32-bit ImageMagick DLL distribution along with a 32-bit VC11 thread safe DLL wrapper to match.
The instructions below should work equally well with WampServer as there is no dependency on the Windows web framework.
The important thing to understand here is that you must know your web server environment and what components are installed and built with. you must match bitness, Visual C runtime, and thread safety configurations together.
Step #1: Install imageMagick to C:\ImageMagick
Go to Link and download the latest release. Use the 32 bit DLL version (ImageMagick-6.9.0.0-Q16-x86-dll.exe)
Install it into C:\ImageMagick directory
Step #2: Get the PHP wrapper from the Windows PECL repository
Go to http://pecl.php.net/package/imagick
Get the latest stable version, 3.1.2. You want the 32-bit, VC 11, thread safe version
php_imagick-3.1.2-5.6-ts-vc11-x86.zip
Step #3: Create distribution directory
Create a /php/ext/imagemagick directory
Copy the ZIP into it and unzip it
Step #4: Make backup copy of DLLs
Make a C:\ImageMagick\Backup directory
Copy DLLs in the C:\ImageMagick directory to the C:\ImageMagick\Backup directory
Step #5: Overwrite DLLs
This is the most important step that if you don't do, will result in the PHP wrapper not loading correctly:
Take all the DLL files in \php\ext\ImageMagick and overwrite those in C:\ImageMagick
If you do a SET on the DOS command line you will see that the ImageMagick installer had created a entry into the system variable environment path (i.e. to C:\ImageMagick). Supporting DLLs will be picked up from there and they will be the Pecl Windows repository DLLs, not the distribution.
Step #6: Set module extension in PHP.INI
First, copy the php extension wrapper php_imagick.dll into the /php/ext directory. Then modify the PHP.INI to do this:
extension=php_imagick.dll
Step #7: Reboot Apache
Reboot Apache
Go to phpinfo and see that imagick is installed as a module.
Here's where you can learn more about your environment.
Pay attention to stuff in phpinfo like:
Compiler: MSVC11 (Visual C++ 2012)
Architecture: x86 (32 bit; as opposed to x64 which is 64 bit)
Thread safety: enabled (TS)
Apache Environment Configuration (PATH should have C:\ImageMagick included)
More gory details: Installing ImageMagick with PHP and Windows
This might not be a programming question but I am posting it after long search and confusion.
I have a dedicated server running Windows server 2008/64bit running Apache as a web server and using PHP 5.3.9
I am trying to install APC extension for Apache. From what I found on php.net I should use a V6 version because I am using Apache.
I searched everywhere to find APC for PHP 5.3 vc6 x64 and found nothing
This comment says that "it’s not possible to compile 64 bit PHP binaries with VC6 since it does not have 64 bit compiler" I don't know if that's true or just an assumption
Any help will be gladly appreciated/
Update, I cannot use VC9 as stated on windows.php.net
If you are using PHP with Apache 1 or Apache2 from apache.org you need to use the VC6 versions of PHP
If you are using PHP with IIS you should use the VC9 versions of PHP
VC6 Versions are compiled with the legacy Visual Studio 6 compiler
VC9 Versions are compiled with the Visual Studio 2008 compiler and
have improvements in performance and stability. The VC9 versions
require you to have the Microsoft 2008 C++ Runtime (x86) or the
Microsoft 2008 C++ Runtime (x64) installed
Do NOT use VC9 version with apache.org binaries
VC9 versions of Apache can be fetched at Apache Lounge. We use their
binaries to build the Apache SAPIs.
Thanks
UPDATE
I was given wrong information about the server configuration and settings. phpinfo() revealed the following:
Compiler MSVC9 (Visual C++ 2008)
Architecture x86
So I used built VC9 and x86 and it worked perfectly.
I used to run PHP as an Apache module on my Windows development machine. However, as PHP has stopped releasing VC6 binaries, I run the VC9 non theadsafe 32-bit versions as a FCGI module. There is plenty of documentation from both Apache and PHP on how to install these.
Then all you have to do is download the latest APC dll from here. Make sure you get the non-threadsafe version (nts), plonk it in your ext folder and just enable it like any other extension.
Edit: Didn't see that you wanted to run the 64-bit version. I haven't had a chance to try that out. However, if you are happy with running 32-bit versions of Apache and PHP, the above should work well.
I need to install PHP 5.3.x (preferably x >= 4) on Windows box running Apache. Unfortunately, in the PHP downloads page, I cannot find any PHP 5.3.x compiled with VC6. So...
Can I use the VC9 binaries on Apache?
If so, how? Do I have to do anything special?
From the release announcement:
Windows users: please mind that we do no longer provide builds created
with Visual Studio C++ 6. It is impossible to maintain a high quality
and safe build of PHP for Windows using this unmaintained compiler.
For Apache SAPIs (php5_apache2_2.dll), be sure that you use a Visual
Studio C++ 9 version of Apache. We recommend the PHP builds as provided
by ApacheLounge. For any other SAPI (CLI, FastCGI via mod_fcgi, FastCGI
with IIS or other FastCGI capable server), everything works as before.
Third party extension providers must rebuild their extensions to make
them compatible and loadable with the Visual Studio C++9 builds that we
no longer provide.
http://www.apachelounge.com/download/
http://www.apachelounge.com/viewtopic.php?t=2743 - In this thread, they say that using VC9 PHP is not recommended at all with VC6 Apache, even though it might work at first. They don't say why.
http://windows.php.net/qa/ - Here, they also state not to use PHP5.3 VC9 with Apache compiled with VC6 (and also don't state why).
I think it might be best to upgrade your Apache to the VC9 version: http://www.apachelounge.com/download/
PHP 5.3.5 for VC6 server is still available: http://windows.php.net/downloads/releases/archives/
I'm fairly sure you can install the VC9 versions of Apache from http://www.apachelounge.com/download/ and they will work with the 5.3.x VC9 builds.