bugcoder Posted October 14, 2012 Share Posted October 14, 2012 Hello experts, I am trying to run linux command for converting xls to csv file using php shell_exec but I am getting nothing in $output variable in following code. Paths etc are fine. $filePath = 'files/temp_file_location/temp_name.xls'; $csvOutput = 'files/temp_file_location/output.csv'; chdir('files/temp_file_location' ); $output = shell_exec("ssconvert --export-type=Gnumeric_stf:stf_csv $filePath $csvOutput"); echo $output; My above linux command is working perfectly fine in terminal window. Will be greatful for any kind of help. Link to comment https://forums.phpfreaks.com/topic/269444-linux-command-in-php-shell_exec/ Share on other sites More sharing options...
requinix Posted October 14, 2012 Share Posted October 14, 2012 Does ssconvert output anything? Does it go to stdout or stderr? Did it error out and/or did it create the CSV output? Link to comment https://forums.phpfreaks.com/topic/269444-linux-command-in-php-shell_exec/#findComment-1385101 Share on other sites More sharing options...
bugcoder Posted October 14, 2012 Author Share Posted October 14, 2012 well it was not outputting anything and neigther it was converting to csv file now I am using catDoc following command but similar thing is happening. no output and no csv file. exec("xls2csv -x temp_name.xls -s cp1252 -d 8859-1 > output.csv"); whereas it works fine in terminal window. Link to comment https://forums.phpfreaks.com/topic/269444-linux-command-in-php-shell_exec/#findComment-1385103 Share on other sites More sharing options...
kicken Posted October 14, 2012 Share Posted October 14, 2012 Specify an absolute path to the xls2csv executable. The server is likely going to have a different PATH environment variable than you do in your terminal window which means it may not be finding the program. Link to comment https://forums.phpfreaks.com/topic/269444-linux-command-in-php-shell_exec/#findComment-1385106 Share on other sites More sharing options...
bugcoder Posted October 14, 2012 Author Share Posted October 14, 2012 Thanks Kicken I was using absolute path for ssconvert command but wasn't working but now its working for catdoc command. Link to comment https://forums.phpfreaks.com/topic/269444-linux-command-in-php-shell_exec/#findComment-1385108 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.