Warnings running maintenance.php

Warnings running maintenance.php

by Christopher King -
Number of replies: 4

Good day,

When I enter maintenance mode with the following command, it succeeds, but gives some weird stuff:  info about content type, like for the top of a .html page, and some warnings.  This is entered from an SSH terminal session.  The server is a VPS system running cPanel/WHM.  I'd appreciate any thoughts about what I'm doing wrong.

[user moodle]$ /path/to/php admin/cli/maintenance.php --enable
Content-type: text/html; charset=UTF-8

<br />
<b>Warning</b>:  Use of undefined constant STDOUT - assumed 'STDOUT' (this will throw an Error in a future version of PHP) in <b>/path/to/moodle/lib/clilib.php</b> on line <b>35</b><br />
<br />
<b>Warning</b>:  fwrite() expects parameter 1 to be resource, string given in <b>/path/to/moodle/lib/clilib.php</b> on line <b>36</b><br />
Your site is currently in CLI maintenance mode, no web access is allowed.
[user moodle]$

Thanks,

Chris

Average of ratings: -
In reply to Christopher King

Re: Warnings running maintenance.php

by Ken Task -
Picture of Particularly helpful Moodlers

Your /path/to/php isn't finding php-cli - command line PHP.

So attempt to discover where it is:

which php

should show the path to php-cli

To be sure that's php-cli, type:

/path/you/see/in/which/response/php -v

That should respond with a php-cli at the top.

If it does, use that path in any code/admin/cli/ scripts.

'SoS', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Warnings running maintenance.php

by Christopher King -

Thanks, Ken!  Using the commands you gave, I corrected the path, and that took care of the problem. 

Sure is nice to have a pro like you here.

Chris

In reply to Christopher King

Re: Warnings running maintenance.php

by Ken Task -
Picture of Particularly helpful Moodlers

Welcome!  You might want to check the config of your cron job for moodle.   That should use the same path for cli php to /full/path/to/code/admin/cli/cron.php.

And feel free to rate posting that helped as 'Useful'!  [helps maintain my badge! ;)]

'SoS', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Warnings running maintenance.php

by Christopher King -

Eep!  Hadn't even thought about the cron job.  It, too, needed to be changed.