To install Apache with PHP 5 on Windows follow the given steps. If your PHP and Apache versions are different then please take care accordingly.
Step 1
Download Apache server from www.apache.org/dist/httpd/binaries/win32. You want the current stable release version with the no_src.msi extension. Double-click the installer file to install; C:Program Files is a common location. The installer will also ask you whether you want to run Apache as a service or from the command line or DOS prompt. We recommend you do not install as a service, as this may cause problems with startup.
Extract the PHP binary archive using your unzip utility; C:php7 is a common location.
Rename php.ini-development to php.ini. Open this file in a text editor (for example, Notepad). Edit this file to get the configuration directives; At this point, we highly recommend that the new users set error reporting to E_ALL on their development machines.
Tell your Apache server where you want to serve files from and what extension(s) you want to identify the PHP files (.php is the standard, but you can use .html, .phtml, or whatever you want). Go to your HTTP configuration files (C:Program FilesApache GroupApacheconf or whatever your path is), and open httpd.conf with a text editor. Search for the word DocumentRoot (which should appear twice) and change both the paths to the directory you want to serve files out of. (The default is C:Program FilesApache GroupApachehtdocs.). Add at least one PHP extension directive as shown in the first line of the following code −
Step 2
Sep 24, 2018 I've installed latest XAMPP server with PHP 7 (update: checked also PHP 7.1) (on my Windows 10 system). Wanted to use opcache, so I enabled it in php.ini. opcache zendextension=phpopcache.dll.
Open a text editor. Type: <?php phpinfo(); ?>. Save this file in your Web server's document root as info.php. Start any Web browser and browse the file. You must always use an HTTP request (http://www.testdomain.com/info.php or http://localhost/info.php or http://127.0.0.1/info.php) rather than a filename (/home/httpd/info.php) for the file to be parsed correctly
You will see a long table of information about your new PHP installation message Congratulations!
I'm trying to install Apache 2.4.38 and PHP 7.3.1 on my Windows 10 machine, but I'm getting the following error:
I'm using the following versions of Apache and PHP:
- httpd-2.4.38-win32-VC15.zip
- php-7.3.1-Win32-VC15-x86.zip
Things I've already checked:
- Both Apache and PHP are compiled with the same version of C++ Redistributable Visual Studio
- I'm using the Thread Safe version of PHP
- The file php7apache2_4.dll is in the main PHP folder and I've copied it to the folder Apache24/modules
I've added the following lines to the httpd.conf file line
- LoadModule php7_module modules/php7apache2_4.dll
- AddType application/x-httpd-php .php
- PHPIniDir 'C:/Anton/PHP7'
I've also tried using the x64 variant, but with the same result. What am I missing / doing wrong?
1 Answer
The following change worked. Changing the line:
LoadModule php7_module modules/php7apache2_4.dll
to
LoadModule php7_module C:/Anton/PHP7/php7apache2_4.dll