php purgecaches.php - "Could not open input file"/"Web server software ({$a}) is not supported"

php purgecaches.php - "Could not open input file"/"Web server software ({$a}) is not supported"

by Bo Pierce -
Number of replies: 9

Hello world,

I am new here. My local Moodle installation has been running for days, and everything seems to work as expected except for this one CLI thing:

$ php purgecaches
Could not open input file: purgecaches


$ php -f purgecaches
Could not open input file: purgecaches


$ php purgecaches.php     # same result with -f flag
<!DOCTYPE html>
<html  lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Error</title>
</head><body><div style="margin-top: 6em; margin-left:auto; margin-right:auto; color:#990000; text-align:center; font-size:large; border-width:1px;
border-color:black; background-color:#ffffee; border-style:solid; border-radius: 20px; border-collapse: collapse;
width: 80%; -moz-border-radius: 20px; padding: 15px">
Web server software ({$a}) is not supported, sorry.
</div></body></html>


$apache2 -v
Server version: Apache/2.4.7 (Ubuntu)
Server built:   Apr 18 2018 15:36:26


$ cat version.php | grep "release  ="
$release  = '3.6dev (Build: 20180920)'; // Human-friendly version name


Any tips?

Average of ratings: -
In reply to Bo Pierce

Re: php purgecaches.php - "Could not open input file"/"Web server software ({$a}) is not supported"

by Ken Task -
Picture of Particularly helpful Moodlers

If Ubuntu, thought that distro had a php-cli extension?

What do you see issuing php -m |grep cli

Run the  command as sudo:

cd /path/to/moodle/code/admin/cli/

Then issue:

sudo php purge_caches.php (notice the _?)

Any script in admin/cli/ is for command line only.

Running the other purgecaches.php found in /moodlecode/admin/ intended for browser use.  Running it from command line should beget this:

php purgecaches.php
Command line scripts must define CLI_SCRIPT before requiring config.php

And a question ... since you are new ... running 3.6.dev ... that's development version meant for development/testing ... not production.   That version hasn't been released yet for general use.  The highest in production/general use (stable) is 3.5.x.

'spirit of sharing', Ken


In reply to Ken Task

Re: Moodle in English: Re: php purgecaches.php - "Could not open input file"/"Web server software ({$a}) is not supported"

by Bo Pierce -
I hope that replying via email goes okay. The Moodle.org servers seem

bad today, and I cannot access the forum at this moment.





On Sun, Sep 30, 2018 at 1:22 PM Ken Task (via Moodle.org)
In reply to Bo Pierce

Re: Moodle in English: Re: php purgecaches.php - "Could not open input file"/"Web server software ({$a}) is not supported"

by Bo Pierce -

Okay, plaintext emails do not work as expected, here, which is too bad, especially since emailing our responses is a promoted feature.  (My post was greatly truncated)

Trying again from my browser...

In reply to Ken Task

Re: php purgecaches.php - "Could not open input file"/"Web server software ({$a}) is not supported"

by Bo Pierce -
On Sun, Sep 30, 2018 at 1:22 PM Ken Task (via Moodle.org) wrote:
>
> If Ubuntu, thought that distro had a php-cli extension?

Probably, but I have manually installed all of the PHP extensions on this version. I have no reason to think my PHP CLI abilities are in any way limited, other than the reason for my first post.


> What do you see issuing php -m |grep cli

No output.


> ...Then issue:
>
> sudo php purge_caches.php (notice the _?)

Do you have any ideas about, why I cannot use that command in the
normal fashion?
Also: I tried running that script from a path which was *not* my
Moodle installation, and it executed exactly as you might expect, that
is, it immediately failed, but at least it ran.


> Any script in admin/cli/ is for command line only.
>
> Running the other purgecaches.php found in /moodlecode/admin/ intended for browser use.  Running it from command line should beget this:
>
>  php purgecaches.php
> Command line scripts must define CLI_SCRIPT before requiring config.php

Well, that was the original output,
But then I found this post from Tim Hunt
https://moodle.org/mod/forum/discuss.php?d=183170

So, lib/setup.php currently contains the following 4 lines commented out:

 // if (!CLI_SCRIPT) {
 //     echo('Command line scripts must define CLI_SCRIPT before requiring config.php'."\n");  //     exit(1);  // }

I probably should have mentioned that earlier, but my access to the
internet is very sketchy, and during the 12 hours that it took for me
post my message, I lost track of that detail.


> And a question ... since you are new ... running 3.6.dev ... that's development version meant for development/testing

Excellent. That is what I came here to do.
Thank you for your help.
In reply to Bo Pierce

Re: php purgecaches.php - "Could not open input file"/"Web server software ({$a}) is not supported"

by Ken Task -
Picture of Particularly helpful Moodlers

Yes, Moodle forums were having some hickups today.   Happens!

"Do you have any ideas about, why I cannot use that command in the
normal fashion?

Also: I tried running that script from a path which was *not* my
Moodle installation, and it executed exactly as you might expect, that
is, it immediately failed, but at least it ran."

If one were a developer would assume that person knows about diff.  Basically ... one script has a 'required' and the other doesn't.   Have not a clue as to what the 'Also' means ... but then again, am not a developer. smile

Suggest, if you are a developer, to post your  questions in a more appropriate forum:

https://moodle.org/mod/forum/view.php?id=55

Happy Hacking! smile

'spirit of sharing', Ken


In reply to Ken Task

Re: php purgecaches.php - "Could not open input file"/"Web server software ({$a}) is not supported"

by Bo Pierce -

On Sun, Sep 30, 2018 at 5:48 PM Ken Task (via Moodle.org)  wrote:
> Suggest, if you are a developer, to post your questions in a more appropriate forum:

I am pretty sure that the forums are subdivided by topic, not by the status of the people posting. As for convention, 3 out of 4 sampled search results for "purgecaches.php," are listed under "general help," none of which referred anybody to the Developer forum. But if you still think my questions are inappropriately located, you may refer them to Mr. Miller and Mr. Barnard, so that somebody may move this thread to a better category.

I trust that you will keep this a welcoming place for people of all experience levels to find answers. Thank you for your help.

In reply to Bo Pierce

Re: php purgecaches.php - "Could not open input file"/"Web server software ({$a}) is not supported"

by Ken Task -
Picture of Particularly helpful Moodlers

Hmmm ... posting you found ...

"This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic." and was concerning an issue  for version 2.x.

Plus ... seems you were having a frustrating time (due to number of other postings) and thought you might have missed the Developers forum which is at the bottom of forum listings.

So someone trying to help out wouldn't have known (no info in profile) IF poster would be better served by directing them to a place more appropriate for the info they seek ... which I see from latest posting is in developer. smile

Didn't think I was being 'un-friendly' .... but, as long as you find what you seek, then all is well. smile

BTW, graduated from HS @ Eielson and attended UofA in Fairbanks for a year.

'spirit of sharing', Ken


In reply to Ken Task

[Solved] Re: php purgecaches.php - "Could not open input file"/"Web server software ({$a}) is not supported"

by Bo Pierce -

I hope that this is the proper way to add [Solved] to a subject line as recommended by the Code of Conduct. https://moodle.org/mod/page/view.php?id=7080

In reply to Bo Pierce

Re: [Solved] Re: php purgecaches.php - "Could not open input file"/"Web server software ({$a}) is not supported"

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Thanks Bo for adding [Solved] to the subject line. It is indeed the recommended way, as it helps when people search the forums to identify questions which are answered.