bukka / php-fann

PHP wrapper for FANN (Fast Artificial Neural Network Library)
Other
213 stars 35 forks source link

Unable to work in windows #13

Open Adamloh opened 10 years ago

Adamloh commented 10 years ago

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 !

bukka commented 10 years ago

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

Adamloh commented 10 years ago

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

weltling commented 10 years ago

@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?

Adamloh commented 10 years ago

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.

weltling commented 10 years ago

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.

c4tz commented 10 years ago

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.

weltling commented 10 years ago

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

c4tz commented 10 years ago

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. :)

weltling commented 10 years ago

@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.

c4tz commented 10 years ago

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!

GeekKorky commented 6 years ago

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

Mister-Fil commented 4 years ago

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

geekgirljoy commented 4 years ago

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_onfile()

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

Whereas: _fann_createstandard() _fann_set_activation_functionhidden() _fann_set_activation_functionoutput()

Seem to work okay.

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

_fann_trainepoch()

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 commented 4 years ago

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_onfile()

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

Whereas: _fann_createstandard() _fann_set_activation_functionhidden() _fann_set_activation_functionoutput()

Seem to work okay.

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

_fann_trainepoch()

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_phpfann.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.