Yet another web applications tutorial - Reply 1

Hello @joeblog,

Am most impressed by your work. As an amateur web-prologian trying to teach myself how to build a web site in Prolog, I installed your tutorial on Ubuntu 18.04 and tried to run it. However, I received a “permission denied” (as non-root) and a “Refusing to run HTTP server as root” message when I switched to su. Here is the output of the ‘swipl server.pl’ command for non-root and root executions:

Non-root:
"(base) aldn@aln-sys:~/plserver/ajax$ swipl server.pl --port=3030 --pidfile=http.pid

ERROR: open/3: No permission to open source_sink `‘http.pid’’ (Permission denied)

Root:
(base) root@aln-sys:/home/aldn/plserver/ajax# swipl server.pl --port=3030 --pidfile=http.pid

ERROR: ‘Refusing to run HTTP server as root’: No permission to open server `http’

Obviously, I must have missed something basic, but can’t see what it is. I would therefore be very grateful to you if you kindly could suggest me any possible way of solving this problem.

With my best regards in the meantime.

1 Like

Try adding --user=myusername, ie

swipl server.pl --port=3030 --pidfile=http.pid --user=myusername

if you’re calling the script as root.

Another possible reason is port 3030 (or whatever you are using) is blocked by default by whatever firewall Ubuntu uses. I hit various snags deploying web applications on Centos because I needed to invoke a semanage command to open the ports I was using.

(Thanks for the reminder I should update my tutorial since I’ve learnt quite a bit since then.)

1 Like

Yes, indeed it works (as root). When entering a name and making a request, the server replies with a “Hello XYZ” message… even in French (my mother tongue).

Thank you very much for your guidance.

1 Like