Are there anyone that has any solution to this issue or has information how to run php commands in a secure way ?
Thomas
You don't have to use a PHP shell command to run cron. Have you read the cron instructions on Moodle docs? If not have a look and then come back here if you need more help.
Tim.
Tim
I think Thomas is referring to the security settings in Windows which mean that any command shell executions (not PHP ones) that are needed to be executed are usually given full rights of the anonymous IUSR_machinename user for anything to work - big security issues here
.
The way to go on this one is to create an account with sufficient privileges and apply this to the executable. See Rory Allford's post in this thread.
Ken
you are right, the cron job is basically ok, we set that up as a scheduled task. The problem is that moodle checks and starts the php command with a shell exec. In PHP 5 I have found a file called php-win.exe that is supposed to NOT run in a shell, but I am not sure how to implement it...
Thomas
Thomas
From reading this document, the php-win.exe is a replacement for the old php-cli.exe - so it looks like it still runs in a command shell, but without any output shown.
It would be useful to know which moodle command are you trying to get to run through shell.exe, so that I can try and test things out also.
Thanks
Ken
I think that for example the backup job fails since it runs php in a shell. If I run the unit test, I get the error:
Fail: lib/simpletest/slowtestcode.php
slow_code_test
test_php_syntax
Cannot test PHP syntax because PHP is not on the path. at [C:\Inetpub\wwwroot\elearning\lib\simpletest\slowtestcode.php line 34]
It looks like this error is the result of the failure of
if (!shell_exec($this->phppath . ' -v')) {
This is a test is a shell can be opened, isn't it ?
In the install.txt in php5 the php-win.exe is explained with "executes scripts without an opened command prompt". Does that mean that it still opens cmd.exe, but hidden, or is it a real windows application ?
Thomas