Webjames autoindex crash
Jim Nagel (444) 25 posts |
Anybody here with expertise in using Webjames? For the past 18 months or so I use it as a local development server when writing web pages that use PHP, and also use it to serve a few pages over the household network. One thing plagues me, and I am floundering to know whether it’s something wrong in my configuration or a bug in the distributed version of the software. Namely: Any attempt to get an autoindex causes Webjames to crash with a segmentation error, leaving sockets open. In other words, when a directory of my website contains no index.html (or equivalent) file, Webjames should (as specified in the /htaccess file for that dir) serve up a page that lists the contents of the directory — instead, it crashes. The problem occurs in the 2013 version of Webjames (the 11MB patched runimage from Chris Gransden where PHP is compiled into Webjames). I have tried contacting him, but no reply. Nevertheless, the “bare” original version of Webjames by Alex Waugh (version 0.48 dated 2007) correctly serves up a directory listing. The ISP’s Apache server also correctly yields directory listings for my uploaded files. Maybe the problem could be cured if I change some setting in my Attributes file within Webjames that would point to a custom Autoindex routine. However, I’m boggled by the syntax required in Attributes — expertise welcome! |
Rick Murray (539) 13840 posts |
I don’t use PHP in my version of WebJames, sorry. I write my add ons in BASIC. It is possible that it is of a vintage that there’s something that more modern machines get upset by… Segmentation error usually means “oh crap, I got caught talking to memory I shouldn’t”. Zero page access? Unfortunately there does not seem to be any source for that version of WebJames. There’s source for the server, and there apparently a set of patches for some flavour of PHP, and as to how to link the two together…. Um…. Just out of interest, how are you invoking php? Have you specified that html files should be treated as php, or not? |
Jim Nagel (444) 25 posts |
Rick asked: Such s file has both a “.php” extension and RiscOS filetype PHP (&18A). When developing, I launch it from within StrongEd via a button that invokes “URI_Dispatch ”http://localhost/…"">http://localhost/…" |
Steffen Huber (91) 1953 posts |
Segmentation error could be a symptom of a WimpSlot not quite large enough. Is this a UnixLib based port where you could force it to use a DA? |
Jim Nagel (444) 25 posts |
Runfile in Alex Waugh’s Webjames 0.48 (which I refer to as the “bare” version) specifies wimpslot -min 1000k -max 1000k. !Runimage is only 62K. Chris Gransden’s patch [ 2013, from https://riscosports.co.uk//downloads.html ] consists only of a new Webjames !runimage (10MB, filetype Absolute) that has PHP compiled in. Chris’s readme says nothing about wimpslot, but I amended the !run file to say wimpslot -min 11000k -max 15000k. Did not cure the Autoindex crash. Inspecting the absolute !runimage with StrongEd, I see a line about “workspace required”, but I’m completely out of my depth as to whether this could be amended as DA (which I am guessing stands for dynamic area). Chris adds in the readme that because he used GCC 4.1.2 to do the compiling, this version of Webjames now runs on Arm-v7 hardware with alignment exceptions turned on. I use an ArmX6 with Ro 5.25, where R-Comp default is alignment exceptions off; I tried with alignment exceptions ON but still get the Autoindex crash. |
John Sandgrounder (1650) 574 posts |
My version of !Webjames is compiled for PHP and is 13M in size, dated 08 Oct 2016. It does not exhibit the problem you refer to. I downloaded just the !RunImage as “Webjames for Pi 3”, although it is fine on all versions of the Pi. |
Jim Nagel (444) 25 posts |
> I downloaded just the !RunImage as “Webjames for Pi 3” Can you give the URL, please, and I’ll have a look at that. Haven’t heard of it before. |
Jim Nagel (444) 25 posts |
I should add that the Webjames segmentation-fault crash happens when the browser is pointed at ANY non-existent file in http://localhost Still, this does not occur with the “bare” Webjames or with Apache at the ISP host, but only with the patched Webjames (2013, Chris Gransden) that has PHP compiled in. |
Steve Pampling (1551) 8170 posts |
Listed here with a discrete link to the Zip that you apply over the base setup you already downloaded. |
John Sandgrounder (1650) 574 posts |
No. Only because after 3 years, I haven’t got a clue where it it was. The link was given to me on these forums, but I can not find it now. I just downloaded the file and moved on. Perhaps, whoever gave me the link might remember back that far. If not I could put the binary on my server. |
Steve Pampling (1551) 8170 posts |
I couldn’t remember either but a google query found the Riscository article pretty quickly. |
Jim Nagel (444) 25 posts |
Thanks effusively for that. Indeed, why does Chris Gransden not include that patch in the list on his website? I wish I had found it two years ago, would have saved so much wasted time and frustration. Indeed also, though, glad it’s there at all. Autoindex works now! No segmentation fault! Now I’m trying to work out why does /htaccess not get obeyed. It says “DirectoryIndex 001.php” but instead of serving up file 001.php it gives me an autoindex showing contents of the directory! including the /htaccess file in that directory! That file is supposed to be hidden. |
Rick Murray (539) 13840 posts |
How are you blocking the htaccess file? You cannot use “location” there, only in the main config file. Try… <files /htaccess> hidden </files> If that doesn’t work, try /htaccess. (with the dot)? Remember, they’re cached so need to restart WebJames after changing anything. |
Rick Murray (539) 13840 posts |
Ah, I see – you’re getting that because you’re not getting the custom file being served. Um, I’m not sure that’s possible. The help says that DirectoryIndex goes into a directory settings block, but it also says of htaccess that it can contain So… I think you’re going to have to put this stuff into the Attributes file. |
Steve Fryatt (216) 2105 posts |
Slightly tangentially, you do know that this probably doesn’t do what you think it does? Unless your Next slot is set to > 11000k, that will only ever allocate 11000k for WebJames. You’ll only get 15000k if the slot is > 15000k to start with. |
Jim Nagel (444) 25 posts |
Thanks, Steve: I did not know that caveat about the Next slot. But I had already been intending to ask: Since Chris Gransden’s readme that came with his big patch said nothing about altering the original Webjames wimpslot -min 1000k -max 1000k, do we really need to bother about altering it at all? |
John Sandgrounder (1650) 574 posts |
I think not. If only because my !Run file still says wimpslot -min 1000k -max 1000k and !WebJames is happily using 13344K. The next slot is shown as 640K |
Chris Hall (132) 3554 posts |
It’s all down to the application writer. If I write a BASIC programme then it will use the ‘next’ slot but if the following is included:
then it will demand the amount of memory it needs if it hasn’t been allocated enough – if such an amount is not forthcoming it will abort with an error. Pretty primitive but it avoids the ‘not enough memory for this DIM’ error just because you forgot to set the ‘next’ space before running it. Or if you had just started ArtWorks which fiddles with the next slot for reasons I don’t understand. |
Andrew Conroy (370) 740 posts |
Wouldn’t it be easier to use the Wimp_SlotSize SWI to fiddle with the Next slot? |
Rick Murray (539) 13840 posts |
Bad practice, messing around with things that the application should not be messing with?
And if the Wimp isn’t running? |
nemo (145) 2546 posts |
That’s precisely what
Then you already have all the memory. |