0

I have a apache server running on raspberry pi and i want to execute shell script using command through in php,

the code which is to be executed is :

"usr/bin/libreoffice --pt trial1 /var/www/html/Book1.xlsx"

how to run this command ?

Jignesh Joisar
  • 13,720
  • 5
  • 57
  • 57
rahul
  • 58
  • 8
  • 3
    Possible duplicate of [PHP shell\_exec() vs exec()](https://stackoverflow.com/questions/7093860/php-shell-exec-vs-exec) – Shanteshwar Inde Sep 18 '19 at 04:31
  • @ShanteshwarInde no its not,i know the difference ,i asked this because the shell_exec() returns null when executed and nothing happens – rahul Sep 18 '19 at 06:08
  • how we know what you have tried and what not. for this you need to specified all things [read how to ask question](https://stackoverflow.com/help/how-to-ask) – Shanteshwar Inde Sep 18 '19 at 06:29
  • @ShanteshwarInde okay sorry for that , do you have any clues ? – rahul Sep 18 '19 at 13:08

2 Answers2

3

use shell_exec() to run shell script.

And also make sure that exec and shell_exec is enabled in PHP ini.

Dhaval Naphade
  • 555
  • 2
  • 21
0

use shell_exec() built in php function here

shell_exec("usr/bin/libreoffice --pt trial1 /var/www/html/Book1.xlsx")

you can also used built in function exec() or system() here see

Jignesh Joisar
  • 13,720
  • 5
  • 57
  • 57