Installing CURL and MHASH on Windows XP

After uncommenting extensions

extension=php_curl.dll
extension=php_mhash.dll

in php.ini. I started getting getting Apache errors

PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\php-5.2.1\\ext\\php_curl.dll' - 
The specified module could not be found.\r\n in Unknown on line 0

PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\php-5.2.1\\ext\\php_mhash.dll' - 
The specified module could not be found.\r\n in Unknown on line 0

And of course the module would not load. As somebody pointed out there are two ways to make it work:
1. Copying libeay32.dll, ssleay32.dll, and libmhash.dll to C:\windows\system32
2. Adding C:\php-5.2.1 to environment path var
Well, the second method didn't work for me. The first is just fine, and works right away.