User 26c54ae8b9
11-03-2008 12:54:51
Dear Chemaxon,
I'm trying to call jcsearch.bat with PHP, but i have no result (file not found).
I have copied all jchem repertories and file on my linux server and i call jcsearch.bat with full patch with "exec" PHP function.
example : exec( "/web/jchem/bin/jcsearch.bat ....options.... " ).
I have a linux server and a Mysql Database.
Could you help me please ?
If you know how to call jcsearch.bat with an other language, write me please.
Thanks,
Karim.
ChemAxon e274e1bada
12-03-2008 21:48:33
User 26c54ae8b9
13-03-2008 10:57:21
Thanks for your response.
I will try and i will post if i have a problem.
Karim.
User 26c54ae8b9
17-03-2008 21:52:59
Dear Chemaxon,
It doesn't work....
I want to execute jcsearch.bat on a linux serveur.
---------------------------------------------------
I use Php file with the command :
system('jchem/bin/jcsearch.bat -q jchem/bin/3B.mol jchem/bin/3.mol --vaguebond:4 --charge:i -f sdf -o res.sdf',$res);
echo "<pre>" . $res . "</pre>\n";
------------------------------------------------------
When i try :
echo exec ('ls jchem/bin/jcsearch.*');
The command is OK, i have the jcsearch.bat file.
---------------------------------------------------
I have modified the jcsearch.bat :
if ["%JCHEMHOME%"]==[""] (
set JCHEMHOME="/jchem"
-----------------------------------------------------
It doesn't work, the function return the value $res="2", and i have no res.sdf file.
My serveur have no safe mode = on.
Can you help me please ? Must i do a chmod 777 on a file ? or ??????
Thanks
Karim.
ChemAxon e274e1bada
18-03-2008 16:46:20
Hi Karim,
does your jcsearch command run from command line?
You should not use the .bat extension on Linux.
PS:
Using jcsearch is not the most efficient way to search in a database, since
- a new Java Virtual Machine is started each time
- the structure cache is loaded for the whole table each time
If you have some Java experience using JSP would be much more efficient.
Please see our database JSP example:
http://www.chemaxon.com/jchem/examples/db_search/index.jsp
The source of this simple web application can be found in the jchem package under "examples/db_example" with installation instructions in "setup.html"
Regards,
Edvard
User 26c54ae8b9
18-03-2008 20:43:32
Thanks for your response,
I want to use jcsearch commande line on Linux.
if jcsearch is not a good solution, how to use it ? Only with file like sdf, mol... ?
Regards,
Karim.
ChemAxon e274e1bada
18-03-2008 21:45:02
Karim,
jcsearch is a simple but practical tool for testing and demonstrating JChem features, and it is possible to call that from a php code, but it is not the most efficient solution.
We recommend JSP to build a JChem based web application. (JSP (Java Server Pages) is a Java based script language similar as PHP) Please see the link what I wrote above, that is a freeware web application, which is part of JChem package. Feel free to modify it's source code.
Edvard
User 26c54ae8b9
18-03-2008 22:00:09
I have seen the link, and i thank you.
But i haven't a serveur with jsp...i can work only with Php.
I want to know how it doesn't work please...
The system function returns 127.
I have tested jcsearch on easy php on windows XP and it work fine, but not on linux.
Regards,
Karim.
ChemAxon aa7c50abf8
18-03-2008 22:54:31
The return code 127 means that the file you want to execute could not be found.
What does
Code: |
echo exec ('ls -l jchem/bin/jcsearch'); |
give you? (Notice the missing '.*' at the and of the command.)
Thanks
Peter
User 26c54ae8b9
19-03-2008 18:42:30
When i execute echo exec ('ls -l jchem/bin/jcsearch');
I have this result :
-rwxrwxrwx 1 web89880 web89880 2650 Mar 10 20:05 jchem/bin/jcsearch
User 26c54ae8b9
19-03-2008 20:36:13
Edvard,
I'm sorry but it doesn't work.
when i execute in index.php :
system('jchem/bin/jcsearch -q jchem/bin/3B.mol jchem/bin/3.mol --vaguebond:4 --charge:i -f sdf -o res.sdf',$res);
echo "<pre>" . $res . "</pre>\n";
I have always value 127.
An another test :
When i delete $res in system function i have no result.
......
Karim.
ChemAxon aa7c50abf8
19-03-2008 21:17:14
At this point, I'd assume the exit code 127 is not for the jcsearch file itself.
Can you capture the standard error of the commands? If so I suggest to do the following:
1. Edit jcsearch putting the following line at the beginning:
2. Then execute
Code: |
system('bash jchem/bin/jcsearch -h', ...); |
What does this give you?
Thanks
Peter
User 26c54ae8b9
19-03-2008 23:01:33
Peter,
It's very strange...
I put : set -x at the beginning of jcsearch file.
When i execute command : system('bash jchem/bin/jcsearch -h', $res);
I have no result...a blank page...and $res=127.
I really don't undestand...i'm sorry.
ChemAxon aa7c50abf8
19-03-2008 23:17:56
One possible reason why the result is a blank page might be that the system PHP command doesn't display (by default?) the standard error. But I am just speculating here, because I am not familiar with PHP.
Peter
ChemAxon 9c0afc9aaf
20-03-2008 10:13:28
Karim,
Since none of us are PHP experts it might worth a try to ask for help on a forum dedicated to PHP issues.
Best regards,
Szilard