Install Mysql Module Php Windows Apache
Apache+mySQL+PHP is for sure among the best and the most popular combinations of web-development products; but sometimes a proper setup is a tricky bit. Among the things that need a lot of messing around is how to enable mySQL under PHP5. While mySQL is in PHP4 implicitly(?) enabled, under PHP5 you have to do all this: After installing Apache 2.0/2.2, PHP5, and mySQL (e.g. By installing ), copy php5apache2.dll or php5apache2_2.dll (depending on your Apache version) to modules directory of Apache. Then, add the following 2 lines to httpd.conf (typically in / conf/ httpd.conf): LoadModule php5_module modules/php5apache2[_2].dll AddType application/x-httpd-php.php This will enable PHP5 to work properly in Apache 2.
To enable mySQL for use in PHP5, you have to do the following: • [not sure if this is really necessary –] Make sure you have valid php.ini file in. • Copy libmysql.dll to the system32 directory (in Windows installation directory). ( php_mysql.dll won’t load without doing this!) • Set the extension_dir in php.ini to the ext directory of your PHP installation directory – typically “extension_dir = ext”. • Enable the mySQL extension in php.ini by un-commenting the line “extension = php_mysql.dll”. • Restart Apache Server.
That’s all enjoy!
Recently decided to install a working Apache 2.4 / PHP 5.4.9 and MySQL 5.5 running locally on my Windows 7 laptop for web design, not using XAMPP or WAMP installation methods. Which are great but this round I wanted to match my Linux server.
An article about how to setup an Apache+PHP+MySQL web server in your Windows computer for testing purposes.
Apache 2.4 Install First download Apache 2.4 from (httpd-2.4.1-win32.zip) Apache 2.4.1 with IPv6 apr-1.4.6 apr-util-1.4.1 apr-iconv-1.2.1 pcre-8.21 lua-5.1 libxml2-2.7.8 openssl-1.0.0g zlib-1.2.6. This release is supported by the PHP 5.4 install from windows.php.net for Apache 2.4. Extract the zip and copy it to the root of C:. This will be C: Apache24 when it is all done. Update: The version of the php5apache2_4.dll must match the version of PHP you are installing.
The link that was reference before has been changed and moved to for versions 5.4.9 and earlier. As of PHP 5.4.10 the module is now included in the Windows build.
PHP 5.4.9 and Earlier Download PHP 5.4.9 VC9 x86 Thread Safe from. Extract and rename folder to php and move to C: Also, download () Runs with PHP 5.4 Thread Safe (TS), and only with Apache 2.4 Win32 VC9 or VC10. PHP 5.4.10 and higher Download PHP 5.4 VC9 x86 Thread Safe from. Extract and rename folder to php and move to C:.
Update: This next edit seems to cause issues with php5apache2_4.dll not found errors, so I have added two options for PHP 5.4.9 and earlier and PHP 5.4.10 and above. I want to thank all those who have brought this to my attention and I hope this helps out. Also, due to the addition of the php5apache2_4.dll being included in PHP 5.4.10 and above builds you no longer need to download the module separately. PHP 5.4.9 and earlier Option 1 Extract php5apache2_4.dll-php-5.4-win32.zip and copy php5apache2_4.dll to the c: php directory. This is needed to allow Apache to use PHP. Edit Apache’s config file, c: Apache24 conf httpd.conf and add the following lines to the bottom of the file. LoadModule php5_module 'c:/php/php5apache2_4.dll' AddHandler application/x-httpd-php.php # configure the path to php.ini PHPIniDir 'C:/php' While we are at it we can add index.php to Apache’s list just incase we want to have a starting page as php.
Find Directory index and add index.php DirectoryIndex index.html index.php Next we need to input a value for ServerName variable. You will have to un-comment it. Save the changes to the config file.
Next move to the Register Apache Service step. PHP 5.4.9 and earlier Option 2 Extract php5apache2_4.dll-php-5.4-win32.zip and copy php5apache2_4.dll to the c: php ext directory. This is needed to allow Apache to use PHP.
Edit Apache’s config file, c: Apache24 conf httpd.conf and add the following lines to the bottom of the file. LoadModule php5_module 'c:/php/ext/php5apache2_4.dll' AddHandler application/x-httpd-php.php # configure the path to php.ini PHPIniDir 'C:/php' While we are at it we can add index.php to Apache’s list just incase we want to have a starting page as php. Find Directory index and add index.php DirectoryIndex index.html index.php Next we need to input a value for ServerName variable. You will have to un-comment it. Save the changes to the config file. Next move to the Register Apache Service step.
PHP 5.4.10 and newer Edit Apache’s config file, c: Apache24 conf httpd.conf and add the following lines to the bottom of the file. LoadModule php5_module 'c:/php/php5apache2_4.dll' AddHandler application/x-httpd-php.php # configure the path to php.ini PHPIniDir 'C:/php' While we are at it we can add index.php to Apache’s list just incase we want to have a starting page as php. Find Directory index and add index.php DirectoryIndex index.html index.php Next we need to input a value for ServerName variable.
You will have to un-comment it. Save the changes to the config file. Next move to the Register Apache Service step. Register Apache Service Now let’s register Apache as a service. Open a command prompt and type. C: apache24 bin httpd -k install If do not want Apache starting automatically at start-up/reboot: GUI Way • START RUN • Type in services.msc, hit Enter or click OK • Locate Apache2 service and double-click (or right-click for Properties) • Find the caption Startup type: (in the middle of the dialog box), use the pull-down and select Manual • Click OK Command line C: >sc config Apache2.4 start= demand Add c: Apache24; c: Apache24 bin to PATH in Environment variables.
PATH ENVIRONMENT (System Properties Advanced Environment Variables System variables Path). Example:;c: php;c: apache24;c: apache24 bin; Now lets check Apache settings by issuing the command, c: Apache24 bin httpd -S PHP Edits Now we have to do a few edits to the php.ini file to tell it to load support for mysql and the location for the extensions. Since there is not a already set php.ini file we need to rename one of the two examples to php.ini.
Rename c: php php.ini-development to php.ini Now let’s edit php.ini Uncomment extension directory.; Directory in which the loadable extensions (modules) reside.;; extension_dir = './'; On windows: extension_dir = 'ext' Uncomment mysql modules extension=php_mysql.dll extension=php_mysqli.dll Save the changes and open a command prompt. Check to make sure it shows loaded modules. C: >php -m So now we have Apache running and configured to use php.
Lets create a file called info.php, save it and see if Apache parses the info correctly to display the results. Open Notepad or your favorite Windows editor and type and save the following. Open your browser and type, localhost/info.php for the location and you should receive alot of information about PHP. MySQL Download and install. Change installation directory to C: MySQL MySQL Server 5.5 instead of Program files as there could be permissions issues.
Once the installation is completed you can let the configuration wizard run and setup the database server. The defaults will work just fine, but remember what you set the password to for root.
PHPMyAdmin PHPMyAdmin is a very nice tool to use for administering your MySQL installation. Download and install.
Extract the file and move to c: apache24 htdocs. Rename directory to phpmyadmin. Create a config directory under phpmyadmin. Open a browser and type localhost/phpmyadmin/setup/index.php to complete the installation. At this point you should have a working Apache / PHP / MySQL installation running and ready for you to start developing!!! Why do you think I’m wrong? Katekyo Hitman Reborn Free Osteoporosis here. Just because it has fliead on your system doesn’t make me wrong.
I test things carefully before putting them on my website or in my books, and I have been running PHP 5.2.0 with Apache 2.2.3 successfully for several months.I have no idea what you have done wrong, but suggest that you start again and use the. Before using it, you need to clean up your system by uninstalling Apache and removing the conf folder before reinstalling. Also remove PHP from the Windows path, and make sure that you don’t have a copy of php.ini in the WINDOWS folder.
Yes, the Windows version of PHP 5.2.0 has srppout for all three series of Apache: 1.3, 2.0, and 2.2. The difference lies in the DLL file used by PHP to communicate with Apache.Apache 1.3 uses php5apache.dll.Apache 2.0 uses php5apache2.dll.Apache 2.2 uses php5apache2_2.dll. I mean, I have Apache 2.2.3 & PHP 5.2.0 and i’ve configured Apache and changed the line LoadModule php5module C:/PHP_HOME/php5apache2_2.dll, and still have nothing, just the message (in the Apache Monitor) The requested operation has failed!.
I don’t know what I’m doing wrong, someone can help me please??? Leave here my e-mail. I pasted the php5apache2_4.dll file into the specified directory. The last few lines of my httpd.conf file looks like this SSLRandomSeed startup builtin SSLRandomSeed connect builtin LoadModule php5_module “c:/php/ext/php5apache2_4.dll” AddHandler application/x-httpd-php.php # configure the path to php.ini PHPIniDir “C:/php” after I install the apache service and I enter the command httpd -k install the following message is displayed “The Apache2.4 service is successfully installed. Testing httpd.conf. Errors reported here must be corrected before the service can be started.
Httpd: Syntax error on line 515 of C:/Apache24/conf/httpd.conf: Cannot load C:/php/ext/php5apache2_4.dll into server: The specified module could not be found.” Can you tell me how to resolve this error. The php module missing tells me you need to check c: Apache24 conf httpd.conf. Extract php5apache2_4.dll-php-5.4-win32.zip and copy php5apache2_4.dll to the c: php ext directory.
This is needed to allow Apache to use PHP. Edit Apache’s config file, c: Apache24 conf httpd.conf and add the following lines to the bottom of the file. LoadModule php5_module “c:/php/ext/php5apache2_4.dll” AddHandler application/x-httpd-php.php # configure the path to php.ini PHPIniDir “C:/php” Also check this piece Rename c: php php.ini-development to php.ini Now let’s edit php.ini Uncomment extension directory; Directory in which the loadable extensions (modules) reside.;; extension_dir = “./”; On windows: extension_dir = “ext” Uncomment mysql modules extension=php_mysql.dll extension=php_mysqli.dll I think your error for httpd -S may stem from a configuration piece incorrect. I have followed your brilliant instructions 100% to the letter, I know I have but I constantly get this error: httpd: Syntax error on line 172 of C:/apache24/conf/httpd.conf: Cannot load C:/P HP/php5apache2_2.dll into server: The specified procedure could not be found. C: apache24 bin>httpd -S httpd: Syntax error on line 172 of C:/apache24/conf/httpd.conf: Cannot load C:/P HP/php5apache2_4.dll into server: The specified procedure could not be found. C: apache24 bin>httpd -k start httpd: Syntax error on line 172 of C:/apache24/conf/httpd.conf: Cannot load C:/P HP/php5apache2_4.dll into server: The specified procedure could not be found. C: apache24 bin>httpd -S httpd: Syntax error on line 172 of C:/apache24/conf/httpd.conf: Cannot load C:/P HP/ext/php5apache2_4.dll into server: The specified procedure could not be found.
C: apache24 bin>httpd -S httpd: Syntax error on line 172 of C:/apache24/conf/httpd.conf: Cannot load C:/P HP/ext/php5apache2_4.dll into server: The specified procedure could not be found. C: apache24 bin>httpd -k start httpd: Syntax error on line 172 of C:/apache24/conf/httpd.conf: Cannot load C:/P HP/ext/php5apache2_4.dll into server: The specified procedure could not be found. C: apache24 bin>httpd -S httpd: Syntax error on line 172 of C:/apache24/conf/httpd.conf: Cannot load C:/p hp/ext/php5apache2_4.dll into server: The specified procedure could not be found. C: apache24 bin>httpd -S httpd: Syntax error on line 172 of C:/apache24/conf/httpd.conf: Cannot load C:/p hp/ext/php5apache2_4.dll into server: The specified procedure could not be found. I just can’t get it to work.
Windows Vista 32. Boris, That was my typo in the test.php it should be a? Instead of $.
And it is the PHP 5.4.0 version that I installed for this post and have not updated to 5.4.8 which is possible to be causing an issue with the module’s. I am currently running Apache 2.4.1 / PHP 5.4.0 built with the exact instructions. I see there is Apache 2.4.3 / PHP 5.4.8 available and will update and see if I get the same issue.
Update: I was able to update to Apache 2.4.3(httpd-2.4.3-win32-ssl_0.9.8.zip ) PHP 5.4.8 VC9 x86 Thread Safe (2012-Oct-17 22:45:30) with the latest php5apache2_4.dll-php-5.4-win32.zip 18 Oct ’12. In the extract php5apache2_4.dll there are sub directories corresponding to the PHP version. I just copied the one from 5.4.8 directory and it all works.
Wondering if anyone can help me with the same problem reported here 1000 times. I’ve read all the comments, but I’m still stuck, somehow. It starts with the error, on Windows 7: [C: Apache24 bin]httpd -k start httpd: Syntax error on line 525 of C:/Apache24/conf/httpd.conf: Cannot load c:/php/php5apache2_4.dll into server: The specified procedure could not be found. The files I’ve downloaded are: php-5.4.9-Win32-VC9-x86.zip httpd-2.4.3-win32.zip php5apache2_4.dll-php-5.2-win32.zip I have VC10 redist installed. PHP installed fine, and lives in c: php. In the c: php folder I have: 10:51 26,624 php5apache2_2.dll 10:51 26,112 php5apache2_3.dll 11:18 25,600 php5apache2_4.dll And my addition to the httpd.conf file reads as follows: LoadModule php5_module “c:/php/php5apache2_4.dll” AddHandler application/x-httpd-php.php PHPIniDir “C:/php” What have I missed?
Thanks in advance, Dave. The errors are pretty much the same and related.
If you look at the comments you see the issue multiple times and each resolution is a bit different. Here’s what I would check. From list you downloaded it looks like you have PHP 5.4.9 but downloaded the PHP 5.2 dll’s Download and copy the dll in the PHP 5.4.9 directory to c: php. It is very important that the version of PHP and the modules match.
Look in the Apache 2.4 win32 modules section and you’ll notice there are 3 different zip’s to download. Otherwise recheck the c: php php.ini and c: Apache24 conf httpd.conf edits. The main things to look at are correct versions, file location, environment PATH and configuration file edits. Amazingly, this now works! I downloaded the file you mentioned, and replaced the version of php5apache2_4.dll that I had (lovely that there are multiple versions of the same filename out there ) and after 10 – 20 iterations of trying to get “httpd -k” commands like uninstall, start, restart, shutdown, etc to work, I finally hit some combination that stopped giving me an error message. Not as scientific or deterministic as I would have liked, but it actually serves up a php page now. Thanks so much for your help!
I’m getting this error when i run it: Errors reported here must be corrected before the service can be started. Httpd: Syntax error on line 525 of C:/Apache24/conf/httpd.conf: Cannot load c:/php/ext/php5apache2_4.dll into server: The specified module could not be found. But I know for sure c:/php/ext/php5apache2_4.dll is there: C: php ext>dir php5* Volume in drive C has no label.
Volume Serial Number is 4258-A68C Directory of C: php ext 05:16 AM 25,088 php5apache2_4.dll What do I need to do to fix this. The errors are pretty much the same and related. If you look at the comments you see the issue multiple times and each resolution is a bit different.
Here’s what I would check. From list you downloaded it looks like you have PHP 5.4.9 but downloaded the PHP 5.2 dll’s Download and copy the dll in the PHP 5.4.9 directory to c: php.
It is very important that the version of PHP and the modules match. Look in the Apache 2.4 win32 modules section and you’ll notice there are 3 different zip’s to download. Otherwise recheck the c: php php.ini and c: Apache24 conf httpd.conf edits. The main things to look at are correct versions, file location, environment PATH and configuration file edits. Make sure you are using PHP 5.4.9 and not the latest 5.4.10 because the php modules for Apache do not support 5.4.10. Here is where you can get it.. Also make sure Download and copy the dll in the PHP 5.4.9 directory to c: php.
It is very important that the version of PHP and the modules match. Look in the Apache 2. Win 2000 Server Sp4 Isotoner. 4 win32 modules section and you’ll notice there are 3 different zip’s to download. Otherwise recheck the c: php php.ini and c: Apache24 conf httpd.conf edits. The main things to look at are correct versions, file location, environment PATH and configuration file edits.
I’ve installed everything as mention here. PHP is working, but includes not I’ve the following line on index.php on root: include (“/includes/all_includes.inc.php”); Inside that PHP have: $includes_path= “”; echo(“Base_Path: ”. $includes_path); include ($includes_path. “settings.inc.php”); include ($includes_path. “database.inc.php”); However, keep having the error that the class is not available. Have this tested and working on Apache 2.2.3 on CentOS Linux and it is working properly Path is already configured on System Variables. I’ve installed everything as mention here.
PHP is working, but includes not I’ve the following line on index.php on root: include (“/includes/all_includes.inc.php”); Inside that PHP have: $includes_path= “”; echo(“Base_Path: ”. $includes_path); include ($includes_path. “settings.inc.php”); include ($includes_path. “database.inc.php”); However, keep having the error that the class is not available. Have this tested and working on Apache 2.2.3 on CentOS Linux and it is working properly Path is already configured on System Variables.
Hey, there is a little error in your guide: You mention that php5apache2_4.dll is included in php5.4.10 and higher, but atleast in the currently available version 5.4.14 this is not the case. There is only a php5.dll and it doesn’t work with it, i get this error when trying to install: httpd: Syntax error on line 526 of C:/Apache24/conf/httpd.conf: Can’t locate API module structure `php5_module’ in file C:/Apache24/php/php5.dll: No error (I moved the php folder inside the Apache24 folder to have it one place, but that shouldn’t be a problem).
The setup seems like it is working, what you are trying to do is turning on some other features. Let’s clear the cron question. Cron is only on Unix / Linux systems, for Windows use Task Scheduler, some starter information here. The referencing of the child nodes sounds like a DNS issue which you could edit the c: windows system32 etc drivers hosts file and add the entries in there or if you have a local DNS server running add the records. As for the uploading files it depends on how you are trying to and where from.
You could install FTP service and SSH (CopSSH) or if you are coding in PHP you can make the config changes in PHP to allow for file uploads. If it is Apache uploads for sites and such look at FTP and SSH options for Windows. First of all thanx for this easiest tutorial. I hv installed php 5.4.9 with apache 2.4.
Everything is working but when i enter in cmd prompt C: >apache24 bin httpd -k start it shows only one usage of each socket address is normally permitted.: AH00072: make_sock: could not bind to address [::]:80 only one usage of each socket address is normally permitted.: AH00072: make_sock: could not bind to address 0.0.0.0:80 AH00451: no listening sockets available, shutting down AH00015: unable to open log. This is what i am not getting. Plz suggest some solution. Do you have single quotes around the line?
If you do the need to be removed. The lines should look like this LoadModule php5_module “c:/php/php5apache2_4.dll” AddHandler application/x-httpd-php.php and check to make sure php5apache2_4.dll is there. One last thing is to make sure your path includes c: php in it and you have rebooted the system. Open a command prompt with Administrator rights and type set path=%path%;c: php. This will put it in the path, restart apache and try again. This will add c: php for the session.
Path had already been updated since I’ve been round the loop already path reads: Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All rights reserved. C: Users user>path PATH=C: Program Files (x86) AMD APP bin x86_64;C: Program Files (x86) AMD APP bi n x86;C: Program Files (x86) PC Connectivity Solution;C: WINDOWS system32;C: WI NDOWS;C: WINDOWS System32 Wbem;C: WINDOWS System32 WindowsPowerShell v1.0;C: Pr ogram Files (x86) ATI Technologies ATI.ACE Core-Static;C: Program Files (x86) Sa msung Samsung PC Studio 3;c: Program Files (x86) QuickTime QTSystem;C: Program Files (x86) Calibre2;c: php;c: apache24;c: apache24 bin; – mixing 64bit and 32bit shouldn’t be a problem should it?
64bit Apache and 32bit PHP. I’m getting an error when I try to start the apache 2.4 service: “Windows could not start the Apache 2.4 on local computer. For more information, review the system event log. If this is a non-Microsoft service, contact the service vendor, and refer to server specific error code 1.” PHP -m Displayed the modules just fine.
And I’m not sure how related this is, but I more or less skipped the following for lack of understand the technical explanation. “C: >sc config Apache2.4 start= demand – //GOT TO THIS LINE Add c: Apache24; c: Apache24 bin to PATH in Environment variables. PATH ENVIRONMENT (System Properties Advanced Environment Variables System variables Path). Example:;c: php;c: apache24;c: apache24 bin;” The result from what I did manage to get into CMD: “C: >sc config Apache2.4 start= demand [SC] ChangeServiceConfig SUCCESS” Edit: Just before posting: “C: >sc config apache2.4 start= demand binPath=;c php v5.5;c: apache24;c: apache24 bin [SC] ChangeServiceConfig SUCCESS” But now when I try to start the service I get an error saying: “Windows could not start the Apache2.4 service on Local Computer. Error 2: The system cannot find the file specified.” Any help or clarification would be greatly appreciated. Hi, I’ve been trying for months to get an instance of Apache 2.4 to run on a port 80 I can make it run without problems what so ever on any other, but I need it on 80 for running a project that requires it.
When I try to install it (the instance of the server), setting the httpd.config so it would ‘hook’ on port 80, i get this error (my server is installed on d: and I don’t have any app listening to the port or I’m not aware I do): ‘D: Apache24 bin>httpd -k install Installing the Apache2.4 service The Apache2.4 service is successfully installed. Testing httpd.conf.
Errors reported here must be corrected before the service can be started. (OS 10013)An attempt was made to access a socket in a way forbidden by its acces s permissions.: AH00072: make_sock: could not bind to address [::]:80 (OS 10013)An attempt was made to access a socket in a way forbidden by its acces s permissions.: AH00072: make_sock: could not bind to address 0.0.0.0:80 AH00451: no listening sockets available, shutting down AH00015: Unable to open logs’ Thank You in advance. I got the same issue. Errors reported here must be corrected before the service can be started.
(OS 10013)An attempt was made to access a socket in a way forbidden by its acces s permissions.: AH00072: make_sock: could not bind to address [::]:80 (OS 10013)An attempt was made to access a socket in a way forbidden by its acces s permissions.: AH00072: make_sock: could not bind to address 0.0.0.0:80 AH00451: no listening sockets available, shutting down AH00015: Unable to open logs’ How to resolve it? I have even used msi set up for apache. It’s still not working.
Hi thanx for a good working tutorial being new to this type of instillation i cannot start apache. The only step i am having a problem with is Add c: Apache24; c: Apache24 binto PATH in Environment variables. PATH ENVIRONMENT (System Properties Advanced Environment Variables System variables Path). Example:;c: php;c: apache24;c: apache24 bin; i am adding P: >;p: dev programs php;p: dev programs apache24;p: dev programs apache24 bin ‘p: dev programs php’ is not recognized as an internal or external command, operable program or batch file. Could anyone tell me what im doing wrong thanks klein.