Page 1 of 1
Unable to load curl for PHP 5, apache & XP
Posted: Tue Jan 23, 2007 5:05 am
by raghavan20
I get the following error when i ran a CURL based script
Code: Select all
Fatal error: Call to undefined function curl_init() in C:\Program Files\Apache Group\Apache2\htdocs\TestIT.php on line 8
i have done the following as of now
1. in php.ini in c:/windows
Code: Select all
;extension=php_mbstring.dll
;extension=php_bz2.dll
extension=php_curl.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_exif.dll
;extension=php_fdf.dll
2. in windows path
Code: Select all
C:\Documents and Settings\Master Wenly>path
PATH=c:\windows;c:\windows\system32;c:\windows\System32\Wbem;c:\program files\ph
p\libeay32.dll;c:\program files\php\ssleay32.dll;c:\program files\php
3. i have also copied ssleay32.dll and libeay32.dll to c:/windows and c:/windows/system32
I still cannot load cURL. any ideas? Thanks.
EDIT:
I also have another doubt.
when i changed php.ini extension setting from
to absolute path,
Code: Select all
extension_dir = "c:\program files\php\ext"
the apache started giving up error
Code: Select all
The application has failed to start because LIBMYSQL.dll was not found. Re-installing the application may fix this problem
Posted: Tue Jan 23, 2007 7:31 am
by feyd
Restarted Apache? Verified the php.ini you edited is the one loading?
get_cfg_var() or
phpinfo() can provide the php.ini path information.
Posted: Tue Jan 23, 2007 7:57 am
by raghavan20
feyd wrote:Restarted Apache? Verified the php.ini you edited is the one loading?
get_cfg_var() or
phpinfo() can provide the php.ini path information.
thanks feyd for your reply
from phpinfo()
Code: Select all
Configuration File (php.ini) Path C:\WINDOWS\php.ini
apache has been restarted many times already.
Posted: Tue Jan 23, 2007 8:27 am
by volka
please run
Code: Select all
<?php
$inifile = get_cfg_var('cfg_file_path');
if ( false==$inifile ) {
die('no config file');
}
if ( false==($cfg=file($inifile)) ) {
die('canot read config file');
}
$extdir = get_cfg_var('extension_dir');
$extdir = str_replace('\\', '/', $extdir);
if( '/'!==substr($extdir,1, -1)) {
$extdir .= '/';
}
echo 'ini: ', $inifile, "<br />\n";
echo 'ext: ', $extdir, "<br />\n";
$pattern = '!^\s*extension\s*=\s*(\S+)!';
foreach($cfg as $p) {
if ( preg_match($pattern, $p, $m) ) {
echo $m[1], ' # ', $extdir.$m[1], ' # ', file_exists($extdir.$m[1]) ? 'ok':'error', "<br />\n";
}
}
?>
and post the output.
Posted: Tue Jan 23, 2007 8:33 am
by raghavan20
Code: Select all
ini: C:\WINDOWS\php.ini
ext: ./ext/
php_curl.dll # ./ext/php_curl.dll # error
php_mysql.dll # ./ext/php_mysql.dll # error
php_mysqli.dll # ./ext/php_mysqli.dll # error
php_xsl.dll # ./ext/php_xsl.dll # error
i could say these are the ones i enabled in php.ini file.
Posted: Tue Jan 23, 2007 9:04 am
by raghavan20
fyi
php installation directory: c:/program files/php
apache installation directory: c:/program files/Apache Group
Thanks.
Posted: Tue Jan 23, 2007 9:37 am
by volka
open C:\WINDOWS\php.ini in a text editor
find extension_dir
set extension_dir = "c:/program files/php/ext/"
save file, restart apache
try again.
Posted: Tue Jan 23, 2007 9:53 am
by raghavan20
volka wrote:open C:\WINDOWS\php.ini in a text editor
find extension_dir
set extension_dir = "c:/program files/php/ext/"
save file, restart apache
try again.
Great, Curl is working but I have a few problems as below.
i tried that but it comes up with this error
Code: Select all
The application has failed to start because LIBMYSQL.dll was not found. Re-installing the application may fix this problem
but still the apache ran.
i ran your script and this is the output
Code: Select all
ini: C:\WINDOWS\php.ini
ext: c:/program files/php/ext//
php_curl.dll # c:/program files/php/ext//php_curl.dll # ok
php_mysql.dll # c:/program files/php/ext//php_mysql.dll # ok
php_mysqli.dll # c:/program files/php/ext//php_mysqli.dll # ok
php_xsl.dll # c:/program files/php/ext//php_xsl.dll # ok
Thanks for your help.
Posted: Tue Jan 23, 2007 11:31 am
by raghavan20
i copied this file, libmysql.dll to apache installation directory and restarted apache and everything is working without error.
i dont really know why apache cannot recognize those files from php installation directory.
Posted: Tue Jan 23, 2007 10:38 pm
by volka
Has to do with the way windows searches for dlls, see
viewtopic.php?t=62010
You now have
Posted: Mon Jan 29, 2007 3:11 am
by raghavan20
on monday morning, i wanted to make a change to a cURL application and comes with this error
Code: Select all
Fatal error: Call to undefined function curl_init() in C:\Program Files\Apache Group\Apache2\htdocs\TestIT.php on line 8
and when i checked from where php.ini is loaded, it is from
Code: Select all
Configuration File (php.ini) Path C:\Program Files\PHP\php.ini
can you guys tell me where should I change setting so that it picks up php.ini from c:/windows ? I checked httpd.conf but I cannot find any line in there specifying the location of php.ini file
Thanks.
Posted: Mon Jan 29, 2007 8:42 am
by feyd
If you're running Apache2, you can set the PHPIniDir directive in httpd.conf. Alternately, you could delete the php.ini it is finding in Program Files.
Posted: Mon Jan 29, 2007 10:17 am
by raghavan20
it works now.
i am running apache 2.2 even though i used apache 2 dll for php to run the PHP.
i could not find any phpIniDir setting inside httpd.conf in apache-install-dir/conf/
i then deleted the file in c:/program files/php which is the php-install-dir then it picked up file from c:/windows.
why is this happening feyd?
thanks for your reply.
Posted: Mon Jan 29, 2007 10:19 am
by feyd
PHP and Windows will use the php.ini found first. Windows will search in the current directory of the executable first before looking in the PATH.
Posted: Mon Jan 29, 2007 10:20 am
by raghavan20
oh good. that is logical even though that is not our expected behaviour.