yaws
yaws copied to clipboard
Yaws: bad conf: Invalide php_handler configuration at line 129: /usr/bin/php7-cgi is not a regular file terminating
Hello!
No Google results to this one yet. In yaws.conf
ok:
php_handler = <cgi, "/usr/bin/php5-cgi">
error:
php_handler = <cgi, "/usr/bin/php-cgi7.0">
The naming convention for version 7 is funny; this is from debian. The general form
php_handler = <cgi, "/usr/bin/php-cgi">
will be redirected to the above.
This is no real problem for me -- I live well with PHP 5, but in some not so distant future this might be a problem.
Question is: what happens here? What does the error message is not a regular file terminating mean? How to get around it?
Regards Karl
Can you provide more context for the error, perhaps copying and pasting the exact errors you're seeing?
Hi,
This means "/usr/bin/php-cgi7.0" is not a regular file :) It is probably a symlink. The "terminating" part does not come from Yaws. The workaround is to use the regular file pointed by the symlink.
Note this is not supported yet by Yaws, but it is possible to follow the symlink, at least on 1 time.
@vinoski The subject is the exact error message, More context:
docker@boot2docker:/c/kklepper/yaws$ docker run -it --rm -v /c/tmp:/tmp -v /c/wp/ci:/ci -v /c/kklepper/yaws/voxx/:/usr/local/lib/yaws/voxx -v /c/kklepper/yaws/include/:/usr/local/li
b/yaws/include --name u1 kklepper/yaws:debian bash
root@df53b5990566:/yaws# yaws -i
Erlang/OTP 17 [erts-6.2] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:true]
Eshell V6.2 (abort with ^G)
1>
=INFO REPORT==== 30-Jan-2018::14:25:07 ===
Yaws: Using config file /etc/yaws/yaws.conf
=ERROR REPORT==== 30-Jan-2018::14:25:07 ===
Yaws: bad conf: Invalide php_handler configuration at line 133: /usr/bin/php5-cgi is not a regular file terminating
root@df53b5990566:/yaws#
@capflam From my Dockerfile:
# need this for PHP7
RUN gpg --keyserver keys.gnupg.net --recv-key 89DF5277
RUN gpg -a --export 89DF5277 | apt-key add -
#RUN apt-get update && apt-get install -y yaws php5-cgi curl && rm -rf /var/lib/apt/lists/*
#Yaws: bad conf: Invalide php_handler configuration at line 129: /usr/bin/php7-cgi is not a regular file terminating
RUN apt-get update && apt-get install -y yaws php7.0-cgi curl && rm -rf /var/lib/apt/lists/*
It is not a symlink:
root@df53b5990566:/yaws# ls -la /usr/bin/php*
lrwxrwxrwx 1 root root 21 Jan 29 20:03 /usr/bin/php -> /etc/alternatives/php
lrwxrwxrwx 1 root root 25 Jan 29 20:03 /usr/bin/php-cgi -> /etc/alternatives/php-cgi
-rwxr-xr-x 10 root root 5038712 Jan 4 20:15 /usr/bin/php-cgi7.0
-rwxr-xr-x 10 root root 5140880 Jan 4 20:15 /usr/bin/php7.0
@kklepper, the errors you have are about "/usr/bin/php5-cgi" and "/usr/bin/php7-cgi". In your listing, these files do not exist.
And my bad. "terminating" comes from Yaws.
@capflam Well, funny enough. It is the Yaws error message talking about php7-cgi. There is no such thing in the PHP7 version. Maybe the mechanism is like this -- Yaws reads
php_handler = <cgi, "/usr/bin/php-cgi7.0">
and interprets this as a user error, silently changing it into
php_handler = <cgi, "/usr/bin/php7-cgi">
There is no error message with
php_handler = <cgi, "/usr/bin/php5-cgi">
The word Invalide suggests that the whole error message is from Yaws. There is no such word in English. It should read invalid.
You're right, the whole message is from Yaws. But Yaws will not silently change anything. Here, in the code, we call file:read_file_info/1 and we check it is a regular file. So you have to check your configuration file to be sure to use the right binary.
Could you share your configuration file ? (don't forget to remove all sensitive data).
Well, I really would've been surprised if Yaws would have acted the way I sketched :-)
Yaws is started by start.sh:
#!/bin/sh
#:~/kklepper/yaws$ start.sh
CONF_FILE="/etc/yaws/yaws.conf"
cd /yaws
yaws --daemon
The configuration file yaws.conf is pretty much standard; I guess you are interested in the server section (PHP 5 version here):
<server localhost>
port = 80
listen = 0.0.0.0
docroot = "/ci" # mapped from /d/wp/ci via docker-compose.yml
auth_log = true
errormod_404 = out404
# php_handler = <cgi, "/usr/bin/php-cgi7.0">
# php_handler = <cgi, "/usr/bin/php-cgi">
#Yaws: bad conf: Invalide php_handler configuration at line 129: /usr/bin/php7-cgi is not a regular file terminating
php_handler = <cgi, "/usr/bin/php5-cgi">
deflate = true
appmods = </, myurl exclude_paths plugins img images styles scripts>
# will exclude those from appmod processing
</server>
There is not much of interest in the Dockerfile either apart from what I already copied (PHP 7 version here):
#FROM ubuntu:14.04
FROM debian
MAINTAINER kklepper [email protected]
# need this for PHP7
RUN gpg --keyserver keys.gnupg.net --recv-key 89DF5277
RUN gpg -a --export 89DF5277 | apt-key add -
RUN echo 'deb http://packages.dotdeb.org jessie all' > /etc/apt/sources.list.d/dotdeb.list
#RUN apt-get update && apt-get install -y yaws php5-cgi curl && rm -rf /var/lib/apt/lists/*
#Yaws: bad conf: Invalide php_handler configuration at line 129: /usr/bin/php7-cgi is not a regular file terminating
RUN apt-get update && apt-get install -y yaws php7.0-cgi curl && rm -rf /var/lib/apt/lists/*
WORKDIR yaws
ENV VER 0.3
VOLUME /wp/ci
COPY ./files/favicon.ico /yaws/www/favicon.ico
COPY ./files/start.sh /yaws/
COPY ./etc/yaws.conf /etc/yaws/yaws.conf
COPY ./voxx /usr/local/lib/yaws/voxx
COPY ./include /usr/local/lib/yaws/include
CMD ["/yaws/start.sh"]
Usually, the Yaws container will be started together with a couple of others by docker-compose -f yaws.yml up -d. For my test above I started the docker container standalone in order to catch the error message more easily -- alternatively, I could have entered the running yaws container in the complex setup and manipulate Yaws from in there. In order to investigate this phenomenon all the other containers are irrelevant; the Yaws container is all you need.
So I can say this: just by toggling the PHP version, I can produce this error. Interestingly, the container with PHP 7 is 10 MB smaller than the other:
$ docker images | grep yaws
kklepper/yaws_php7 debian 4dc06f732ab1 2 hours ago 249MB
kklepper/yaws debian 198a1ed111b6 2 hours ago 259MB
kklepper/yaws_php5 debian 198a1ed111b6 2 hours ago 259MB
I'm really curious what kind of mechanism is behind this behavior. Most probably we would never have guessed. Of course, there is always a big chance of me turning out to be the great idiot :-) But even if so, I don't mind, it wouldn't be the first case that I don't see the obvious.
@kklepper you'll be thrilled to know I've fixed the misspelling of "Invalid" on master in 813e72cd. 🥇
@vinoski Great! :-)
Fixed the issue with a dirty trick: added
ln -s /usr/bin/php-cgi7.0 /usr/bin/php7-cgi
to the Dockerfile....
Now this still does not answer why Yaws looks for
php_handler = <cgi, "/usr/bin/php7-cgi">
when the directive in yaws.conf reads
php_handler = <cgi, "/usr/bin/php-cgi7.0">