php-fann icon indicating copy to clipboard operation
php-fann copied to clipboard

Unable to work in windows

Open Adamloh opened this issue 11 years ago • 14 comments

Dear Bukka,

I have followed your examples in the documentation, but i am not manage to work in my PHP.

Call to undefined function fann_create_standard()

this seems like the library is not linked.

I am using the windows DLL files from the PECL websites, i have included the extension in the php.ini files, The apache server started successfully but i still encoutered this problems

I have the check the phpinfo() and did not found any library linked.

I been stucked here for quite a while, kindly please advise.

Million Thanks !

Adamloh avatar Mar 18 '14 01:03 Adamloh

Is it just php-fann that you can't load. What about other PECL extensions? Does it load ok when you use PECL DLL?

bukka avatar Mar 18 '14 15:03 bukka

It works well with other PECL DLL like, imagick,

At the moment still not manage to get it work.

Kindly advice.

Thanks for quick reply

Adamloh avatar Mar 24 '14 03:03 Adamloh

@Adamloh which apache/php/fann build/version do you use? Can you reproduce the same error on console? What do apache and php error logs say?

weltling avatar Mar 24 '14 12:03 weltling

I am using the wamp 2.2 for the insaller, PHP version is 5.3.13, apache version is 2.2.22, and the PECL dll is version 5.3 Thread Safe (TS) x86.

The warning is Unable to load dynamic library,

the Specified module could not be found.

Adamloh avatar Mar 25 '14 00:03 Adamloh

ok, sounds like a configuration issue at the first glance. One reason might be that the dependency dll isn't on the path. With apache even - CWD is not the PHP dir.

Does it work with the console version of PHP? Please do a quick try like

php -n -d extension_dir=my/ext/dir -d extension=php_fann.dll --re fann

ensuring the dependency .dll is on the path.

Also, from the WAMP download page, please be sure using the 32 bit build.

weltling avatar Mar 25 '14 07:03 weltling

Got the same error, but managed to "fix" it by starting xampp with admin rights ;)

But after that I came across Issue #7 which isn't solved yet.

c4tz avatar Apr 28 '14 19:04 c4tz

@BlkChockr did it work on CLI the way i've suggested to try above? thanks.

weltling avatar Apr 28 '14 20:04 weltling

Yes, that was the point where I realized it had to be run with higher privileges, because I tried your suggestion on a console with admin rights and it worked. :)

c4tz avatar Apr 28 '14 20:04 c4tz

@BlkChockr that's great! So this one is indeed a configuration issue about doublefann.dll being on the %path%. I expect it to work if you add the path to that dll to the apache, or maybe preload in apache, or just add it to the system path. Thanks for staying on this.

@bukka looks like we can close this one after all.

weltling avatar Apr 28 '14 21:04 weltling

Yeah, that's true. I added my xampp\php\ext directory to the PATH and can now start xampp without admin rights to get it work. But still, #7 persists.

It is important to REBOOT after modifying PATH, else there will be no effect from it!

c4tz avatar Apr 29 '14 06:04 c4tz

The same issue my PHP version is 5.6.32 using xampp on windows 10, already followed above steps but no luck.

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

GeekKorky avatar Apr 12 '18 12:04 GeekKorky

The same issue my PHP version is 5.6.32 using xampp on windows 10, already followed above steps but no luck.

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

Add doublefann.dll in folder C:\xampp\php\ solved the problem

Mister-Fil avatar Mar 09 '20 13:03 Mister-Fil

I can confirm that @Mister-Fil 's comment is correct.

It removes the warning however there does seem to be some issues with training ANN's.

If you try running simple-train.php it silently crashes without error.

Running the commands one at a time in the CLI results in the same and no error is displayed or logged.

Specifically the command that seems to result in the crash to terminal/windows command line is:

fann_train_on_file()

PHP FANN Documentation: https://www.php.net/manual/en/function.fann-train-on-file.php

Whereas: fann_create_standard() fann_set_activation_function_hidden() fann_set_activation_function_output()

Seem to work okay.

Given that not all FANN functions were failing I proceeded to test with:

fann_train_epoch()

PHP FANN Documentation: https://www.php.net/manual/en/function.fann-train-epoch.php

Example Code: https://github.com/bukka/php-fann/blob/master/examples/logic_gates/simple_train_epoch.php

This DOES work and results in training a neural network on Windows using FANN-PHP.

Some effort should be put into building a list of which FANN functions are not working on Windows so this can be addressed.

geekgirljoy avatar May 31 '20 19:05 geekgirljoy

I can confirm that @Mister-Fil 's comment is correct.

It removes the warning however there does seem to be some issues with training ANN's.

If you try running simple-train.php it silently crashes without error.

Running the commands one at a time in the CLI results in the same and no error is displayed or logged.

Specifically the command that seems to result in the crash to terminal/windows command line is:

fann_train_on_file()

PHP FANN Documentation: https://www.php.net/manual/en/function.fann-train-on-file.php

Whereas: fann_create_standard() fann_set_activation_function_hidden() fann_set_activation_function_output()

Seem to work okay.

Given that not all FANN functions were failing I proceeded to test with:

fann_train_epoch()

PHP FANN Documentation: https://www.php.net/manual/en/function.fann-train-epoch.php

Example Code: https://github.com/bukka/php-fann/blob/master/examples/logic_gates/simple_train_epoch.php

This DOES work and results in training a neural network on Windows using FANN-PHP.

Some effort should be put into building a list of which FANN functions are not working on Windows so this can be addressed.

I tried this on PHP x64 and it issues the following warning:

PHP Warning: PHP Startup: Unable to load dynamic library 'php_fann.dll' (tried: C:\php\ext\php_fann.dll (The specified module could not be found.), C:\php\ext\php_php_fann.dll.dll (The specified module could not be found.)) in Unknown on line 0 Interactive shell

This seems to suggest that it is looking for: C:\php\ext\php_php_fann.dll.dll

However adding the extra .dll to the filename did not resolve the issue.

So as it is, it seems there are still compatibility issues with the x64 bit PHP-FANN version on Windows and smaller functional issues on the x86 version of Windows.

geekgirljoy avatar May 31 '20 20:05 geekgirljoy