Laravel how to execute a command in crontab from a shared hosting? - php

I've tried this:
php /home/public_html/artisan command:foo test
and I get this error:
No input file specified.
how can I get the exact path to my artisan to execute this??

This is what worked for me:
/usr/local/bin/php public_html/artisan foo

Related

php exec returning sh: 1: 'not found'

So I've installed 'translate-toolkit' to use 'po2txt', everything works fine when I run it in terminal. But when I try run it in a php file,
<?php
exec('po2txt --version');
I get sh: 1: po2txt: not found
I'm really unsure about what I've missed, if I run for example
<?php
exec('git --version');
It returns normally. So I guess I'm unsure as to why it works when I use it in terminal but if I try execute it through a php file it isn't found..
Where is the installation path of po2txt?
You can simply find it by running this command in terminal: which po2txt
check the path of po2txt is exists in your PATH variable?

OVH cron jobs / Symfony Command

I'm developing a Symfony project and I've 4 commands which allows me to update telephony and emails data thanks to OVH' Api. When I use my terminal on local ( php bin/console converseo:updateTelephony ) the command works fine.
Now, I want to put these commands in crontab with the cron interface from Ovh. I made a php file test.php :
<?php
shell_exec("sh test.sh");
?>
And test.sh :
#!/bin/bash
/usr/local/php5.6/bin/php /homez.number/mysite/www/bin/console converseo:updateBilling
And I get the error :
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "converseo:updateBilling" is not defined.
Did you mean one of these?
converseo:updateBilling
converseo:updateEmailCount
converseo:updateTelephony
converseo:updateEmail
The lines are EXACTLY the sames, I don't understand why I get this error.
Thanks a lot for yours answers !

Where is the PHP path in CentOS 6.5 droplet?

Unfortunately I do not have access to the droplet via console, only by Vesta panel and I need to set up cron job.
However, I can not find the right path to PHP. Now that command line looks that and it does not work:
/usr/local/vesta/bin/php5 -c /home/admin/web/ -q /home/admin/web/mysite.com/public_html/crop_scripts/cron.php
Please tell me what options instead of "/usr/local/vesta/bin/php5" I can try?
what does this code show when you access it through your web server (assuming exec call is allowed)
<?php
$output = array();
exec('which php',$output);
var_dump($output);

Gradles init --type java-library works in putty but comes up with error when executing same command from php script

I'm currently trying to incorporate Gradle into a web based java IDE, so that a user could build their files.
I've tested the command to do it using Putty and it yielded the exact results I expected(creating a series of directories and sub directories).
$command = 'cd /home/neema/sites/javaIDE.local/branches/develop/javaIDE/app/java/User1/test1 2>&1';
$command2 = '/home/neema/sites/javaIDE.local/branches/develop/javaIDE/app/gradle/bin/gradle init --type java-library 2>&1';
However when i run the above commands in shell_exec in php(console.logging the response)i get this error.
FAILURE: Build failed with an exception.
What went wrong:
Could not create service of type InitScriptHandler using BuildScopeServices.createInitScriptHandler().
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I ran the stacktrace and this is the result, http://pastebin.com/YaHyWNR6.
I can't for the life of me understand why it won't work.
I've given the folder 'test1' all permissions (777) and now I've resorted to help :)
Thanks in advance to anyone with insight.

how to run cmd in php exec function

I am trying to run a command on windows which is the follwing :
sfm+pmvs C:\\xampp\\htdocs\\temp\\$filename/ hello.nvm
I have done this but it wont work for me :
exec("C:\\xampp\\htdocs\\temp\\draw\\VisualSFM_win32.exe sfm+pmvs C:\\xampp\\htdocs\\temp\\$filename/ hello.nvm");
when I do the following :
exec("C:\\xampp\\htdocs\\temp\\draw\\VisualSFM_win32.exe");
it works just fine but I need the other paramters to be included in the command line
how could that be done in php and is there any way to open a cmd.exe and to run the command above ?
thanks in advance
Exec() just running in cmd command which you wrote as first argument of exec(). If VisualSFM_win32.exe not support arguments by run via cmd, you cannot run it as you want. Sorry for my english =)
You asked me for exapmle. My example below.
I am not sure it is 100% right because i don't use windows last 3 years.
#echo off
cd "C:\xampp\htdocs\temp\draw\"
start VisualSFM_win32.exe sfm+pmvs C:\xampp\htdocs\temp\%1/ hello.nvm
and in php
exec("C:\\test.bat " . $filename);

Categories