Can't run command exec(xelatex file.tex) - php

I'm trying to generate a pdf from a latex file with the command exec but it doesn't seem to recognize "xelatex".
When I echo any other command like "ls" with exec it works.
Also, the file is generated when I run the command from cmd.
Any idea what the problem might be ?
I'm working on windows10.
Thanks,

Related

Run Bash command from PHP 7.0

I've been trying to run the php script:
shell_exec("bash /etc/example.sh")
from the browser but it does not work. This bash file creates a new one on the /etc directory.
I've also tried the functions exec() && system() but they don't work either. The weird thing happens when I run other Linux commands on these php function like:
shell_exec(rm -r /etc/fake);
they work fine, I have also tested my bash file on the linux command line and it works great.
I am sure this is not a permission issue, since I previously set the 777 permission on the file i am trying to execute.
shell_exec("bash /etc/example.sh")
I am using php7.0.33 and Debian 9, so I suppose this may be an issue with this PHP version 7.0.
Thank you for the help.

run php file from shell script in openwrt

I am trying to run a php file from shell script file or terminal in open-wrt platform. I have executed php files in crontab and those are running perfectly. i need to run a php file without putting it into crontab.I am trying it with the following command
chmod 777 /www/api/*
cd /www/api
php myphp.php
but it showing -ash: php: not found
I have also try it putting the following command on top of the script
#!/usr/bin/php
but it is not working. i could not figure out the problem!!!
You must install php-cli package, after you can run the script by
php-cli script.php

execute php script from command line on ubuntu

I can run facebook.php script from ssh below:
cd /var/www/
php facebook.php
But I want to run to script 1 line command because i want to use it on cron. Like this:
php /var/www/facebook.php
I tried other commands on ssh but dont worked. Only first command is worked for me
if /usr/bin/php /var/www/facebook.php is not working, it might a case of your php path is different then /usr/bin/php.

How execute php file in command line?

I have 1 file php: C:\\Xml2InDesign\\InDesignTagConverter.php
I exe it by:
$sjis_cmd="php \"C:\\Xml2InDesign\\InDesignTagConverter.php\";
exec($sjis_cmd, $output);
It not working. What do i must setting?
I run from cmd:
php "C:\Xml2InDesign\InDesignTagConverter.php" "c:\work\link2\\tmp\\5699\\direction.xml" "c:\work\link2\\tmp\\5699\\tables"
Show error: 'php' is not recognized...
Find your php.exe path and run command from there.
Like if your php.exe is in C:\PHP5\php.exe , then you can execute like this
C:\PHP5\php.exe "C:\\Xml2InDesign\\InDesignTagConverter.php\"
Refer this link
OR
if you want to run it through php code then use exec command
The PHP CLI as its called ( php for the Command Line Interface ) is called php.exe It lives in c:\wamp\bin\php\php5.x.y\php.exe ( where x and y are the version numbers of php that you have installed )
If you want to create php scrips to run from the command line that great its easy and very useful.
Create yourself a batch file like this, lets call it phppath.cmd :
PATH=%PATH%;c:\wamp\bin\php\php5.x.y php -v
Save this into one of your folders that is already on your PATH, so you can run it from anywhere.
Now from a command window, cd into your source folder and run >phppath.
Then run
php your_script.php

PHP exec function not working

I am trying to execute a command from php script using php exe function.
The script calls .exe file located in program files whereas my xampp is intalled in E:
I m trying the following command C:\\Program Files\\GPStill\\pstill.exe its not working.But if i manually open cmd prompt and stand in c:\prgram files folder than run pstill.exe it works...
Any ideas ???
you need to escape the folders for example
<?php
$command 'C:\"Program Files"\"Internet Explorer"\iexplore.exe';
exec($command);
?>

Categories