Thursday, 26 February 2009

"Cannot load mysql extension. Please check your PHP configuration" Error with XAMPP


so, if your like me, you've downloaded XAMPP... managed to get apache to start, but having trouble with MYSQL integration, then read on....
If you are simply trying to integrat php and mysql, then you may still find this useful.

You may receive this warning when attempting to access the local MYSQL instance packaged with XAMPP. Usually, this is noticed by clicking on the phpmyadmin on the XAMPP control panel.

1. For me: the problem was because i already had PHP installed on my PC. Therefore, the old installation was being used and it was conflicting!!

2. For others: The problem was due to the "php_mysql.dll" extension being excluded from the php.ini file.

- open php.ini located within the main php dir. For me, this is .\xampp\php\.
- Find "extension=php_mysql.dll" and ensure the semicolon is removed from the start of the string. This will then include the mysql extension.
- Now find the "extension_dir" string, and ensure it points to the 'ext' dir within the php dir. For me, this value is: extension_dir = "\xampp\php\ext\"

3. Lastly: Others find the problem is with a currupted mysql configuration file. This is located within the 'mysql\bin' dir. For me, this is ".\xampp\mysql\bin".
This is a cnf file, and for Windows users, this is the same extension as a SpeedDial file, so it will just be called "my". The best way to edit this, is to use the 'winmysqladmin.exe' tool located in the same directory, or drag the file onto Notepad.exe. Ensure the port is setup to a free port on your system... Mine is the default: 'port= 3306'.

If this is still not working, open "winmysqladmin.exe". (this is now an unsupported application, use phpmyadmin for anything else! You may receive DLL errors when using, but just ignore them.). Execute the 'my.ini setup' tab and a new configuration file can be saved out from here.

Wednesday, 25 February 2009

Starting Apache 2.2 on Windows (applies to *nix also)


I recently downloaded XAMPP the other day, and had a little trouble starting the inbuilt Apache 2.2 web server. Here is what i did to resolve these issues.
(This also applies to NIX systems).

I attempted to start the the apache service [apache_installservice.bat], but I received a strange error. So i decided to open the Apache Monitor manually and start the webserver.

Monitor Location: .\apache\bin\ApacheMonitor.exe

I executed the start button and the server failed to start with an ambiguous error message. I opened the event log and found the following error...

The Apache service named reported the following error:
>>> (OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80


It seemed i already had programs/services running on port 80, so i opened up the Apache config file and altered the port.

Config Location: .\apache\conf\httpd.conf

Change: Listen 80 ---> to: Listen 8080

This will run the server on 8080 rather than 80. (assuming 8080 is free!)... you can check "netstat" on "Start>Run>cmd" to check this.



I then attempted to fire up the web server again, but the same error occured (but with a different port!) This time the port being 443...

The Apache service named reported the following error:
>>> (OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:443 .


This port tells Apache which port SSL associated with. This can also be modified using the SSL config file.

SSL Config file location: .\apache\conf\extra\httpd-ssl.conf

Change: Listen 443 ---> to: Listen 444

(Providing nothing is running on 444)


I then attemted to start the Apache Server, and everything ran smoothly!

Tuesday, 3 February 2009

Increase File Size limits on .NET Web Services.


Add this to the Web.config file.

Code Snippet
  1. <httpRuntime executionTimeout="3600" maxRequestLength="80960"></httpRuntime>
End of Code Snippet
- executionTimeout is given in seconds.
- maxRequestLength is given in KB.

This will increase the accepted file size over SOAP to 80MB with a timeout of 1 hour.