View Single Post
Old 04-21-2012, 05:27 AM   #1
techsp123
Junior Member
techsp123 began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Apr 2012
Device: none
Thumbs down Call ebook-convert from PHP using exec/shell_exec

Hi,

I am using Fedora 14 and clibre installation is working and also i can execute "ebook-convert" (version: calibre 0.8.47) from the command line.

I was trying to convert .pdf to .epub using a PHP file by calling exec/shell_exec. But i get some error -----------
#########################################
Traceback (most recent call last): File "site.py", line 56, in main File "site-packages/calibre/__init__.py", line 21, in File "site-packages/calibre/startup.py", line 65, in File "site-packages/calibre/utils/localization.py", line 70, in set_translators File "site-packages/calibre/utils/localization.py", line 27, in get_lang File "site-packages/calibre/utils/config_base.py", line 432, in File "site-packages/calibre/utils/config_base.py", line 352, in __setitem__ File "site-packages/calibre/utils/config_base.py", line 366, in set File "site-packages/calibre/utils/config_base.py", line 298, in set File "site-packages/calibre/utils/lock.py", line 113, in __enter__ IOError: [Errno 20] Not a directory: '/var/www/.config/calibre/global.py' /calibre/calibre/lib/python2.7/site-packages/calibre/ptempfile.py:27: RuntimeWarning: Parent module 'calibre' not found while handling absolute import /var/www/html/tictlive/temp/j17
#########################################

My php code is: (test.php under /var/www/html/tictlive/temp/j17 directory). and the source file "Bengal_Institute_Documents.pdf" is under directory "dmdocuments" under "j17/" directory.

$infile = "Bengal_Institute_Documents.pdf";
$infile2 = "dmdocuments/".$infile;
$comm1="ebook-convert ".$infile2." a.epub 2>&1";
$r1 = shell_exec($comm1);

echo $comm1."</br>".$r1;

Can any one help !!!
techsp123 is offline   Reply With Quote