php.ini exists, is parsed but HHVM reports that it does not exist
Hi, today find:
Restarting HHVM
[Wed Mar 12 10:30:41 2014] [hphp] [8087:7fc5a0777f80:0:000001] [145e711:c1c4b1:c98ddb:c9a986:9717fe:7fc599e8076d:a11525] INI file doesn't exist: "/etc/hhvm/php.ini"
$ ls -la /etc/hhvm/php.ini
lrwxrwxrwx 1 root root 54 Mar 10 13:38 /etc/hhvm/php.ini -> /project/hhvm/php.ini
$ ls -la /project/hhvm/php.ini
-rw-rw-r-- 1 ubuntu www-data 0 Dec 30 09:24 /project/hhvm/php.ini
It seems that the problem lies in hard coded path to the INI file. https://github.com/facebook/hhvm/blob/cb436ccc00c7f6010aa7311d893c9b3acc40374c/hphp/runtime/base/runtime-option.cpp#L870
The file seems to be read, however.
sounds like a regression from https://github.com/facebook/hhvm/issues/1808
Nobody expects the symlink inquisition!
What version of HHVM are you using? Obvious from the link @tybulewicz posted it shouldn't ever print that message.
@ptarjan 2.4.1.
Same happens on 2.4.2, however:
maciek@Skiing-Yak:[...]$ hhvm --version
HipHop VM 2.4.2 (rel)
Compiler: tags/HHVM-2.4.2-0-g432ecffa04b21c60953bb236a9db8278f4650537
Repo schema: 1be260b29a71097b5d1f78c6e4dcbb981ba03bde
maciek@Skiing-Yak:[...]$ hhvm -c config/etc/hhvm/api-dev.hdf bin/phpunit -c ant/phpunit.xml
[Wed Mar 12 19:35:40 2014] [hphp] [7931:7f3a4ba00f80:0:000001] [1461e01:c1d711:c9a036:c9bbe6:9727ae:7f3a4512276d:a124f5] INI file doesn't exist: "[...]/config/etc/hhvm/php.ini"
PHPUnit 4.0-g46b30b0 by Sebastian Bergmann.
Just to prove that the file is being read (see: https://github.com/iwankgb/hhvm-ini):
maciek@Skiing-Yak:~/projects/hhvm-ini$ hhvm -c test.hdf test.php
INI file doesn't exist: "php.ini"
object(DateTime)#1 (0) {
}
maciek@Skiing-Yak:~/projects/hhvm-ini$ hhvm test.php
HipHop Strict Warning: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /home/maciek/projects/hhvm-ini/test.php on line 2
HipHop Strict Warning: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /home/maciek/projects/hhvm-ini/test.php on line 2
object(DateTime)#1 (0) {
}
@iwankgb is your IniFile setting in config/etc/hhvm/api-dev.hdf pointing at a non-existing ini file? Like, does [...]/config/etc/hhvm/php.ini exist?
IniFile points at existing file. Take a look at my later comments, please.
@iwankgb I did read your later comments but I don't understand your config. In your last comment you have:
INI file doesn't exist: "php.ini"
but you don't prove that php.ini actually exists. I'm also not sure if IniFile can handle relative includes, can you try an absolute path?
@ptarjan, it looks a bit weirder now. It looks to me that:
- Setting
IniFileto a non-existing location surpresses some ini-related errors:
maciek@Skiing-Yak:~/projects/hhvm-ini$ hhvm -c broken.hdf test.php
INI file doesn't exist: "/this/path/does/not/exist"
string(0) ""
- Setting
IniFileto an existing location different than/etc/hhvm/php.inibehaves like point 1:
maciek@Skiing-Yak:~/projects/hhvm-ini$ hhvm -c test.hdf test.php
INI file doesn't exist: "/home/maciek/projects/hhvm-ini/php.ini"
string(0) ""
maciek@Skiing-Yak:~/projects/hhvm-ini$ ls -l /home/maciek/projects/hhvm-ini/php.ini
-rw-rw-r-- 1 maciek maciek 18 mar 12 20:48 /home/maciek/projects/hhvm-ini/php.ini
- Using no configuration file and no ini file shows some errors (but twice):
maciek@Skiing-Yak:~/projects/hhvm-ini$ hhvm test.php
string(0) ""
HipHop Strict Warning: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /home/maciek/projects/hhvm-ini/test.php on line 3
HipHop Strict Warning: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /home/maciek/projects/hhvm-ini/test.php on line 3
- setting
IniFileto/etc/hhvm/php.inibehaves like points 1 and 2:
maciek@Skiing-Yak:~/projects/hhvm-ini$ cat /etc/hhvm/php.ini
date.timezone=UTC
maciek@Skiing-Yak:~/projects/hhvm-ini$ hhvm -c etc.hdf test.php
INI file doesn't exist: "/etc/hhvm/php.ini"
string(0) ""
And it looks that errors are double printed:
maciek@Skiing-Yak:~/projects/phpunit$ hhvm phpunit tests/Regression/578/Issue578Test.php
PHPUnit 4.1-dev by Sebastian Bergmann.
Configuration read from /home/maciek/projects/phpunit/phpunit.xml.dist
..E
Time: 1.56 seconds, Memory: 10.67Mb
There was 1 error:
1) Issue578Test::testUnexpectedExceptionsPrintsCorrectly
Exception: Double printed exception
/home/maciek/projects/phpunit/tests/Regression/578/Issue578Test.php:18
/home/maciek/projects/phpunit/src/Framework/TestCase.php:955
/home/maciek/projects/phpunit/src/Framework/TestCase.php:823
/home/maciek/projects/phpunit/src/Framework/TestResult.php:692
/home/maciek/projects/phpunit/src/Framework/TestCase.php:763
/home/maciek/projects/phpunit/src/Framework/TestSuite.php:722
/home/maciek/projects/phpunit/src/TextUI/TestRunner.php:419
/home/maciek/projects/phpunit/src/TextUI/Command.php:179
/home/maciek/projects/phpunit/src/TextUI/Command.php:132
FAILURES!
Tests: 3, Assertions: 0, Errors: 1.
Generating code coverage report in Clover XML format ... done
Generating code coverage report in HTML format ... done
Any thought about this?
- All the issues found in phpunit's test suite have been fixed for HHVM 3.0.0 - the release should be later today; in the mean time, this should be fixed on master or in a nightly build
- you shouldn't run that particular test directly - it's expected to fail (though in a different way) - it should be ran via phpunit/tests/Regression/578.phpt
Sorry, looks like multiple issues being discussed here
I think the does not exist issue is also fixed in 3.0.0/master/nightlies - we pushed a fix to Facebook yesterday that depended on this issue.
Please try a nightly or 3.0.0 and let us know if you still have this issue.
Hi, yesterday I have tested php.ini on 3.0.0. The result is quite weird. In my opinion HHVM does not read file /etc/hhvm/php.ini by default. I have tried to set path to php.ini in server.ini but none of my combinations worked. Finally I have tried to set date.timezone in server.ini but new DateTime(); always returns UTC irrespective of what I set timezone to. I ended on using old style HDF configuration.
PS. using IniFile = "/etc/hhvm/php.ini" in HDF generates [Wed Apr 2 08:33:03 2014] [hphp] [15941:7f6359a183c0:0:000001] [] Possible bad config node: Server.IniFile
I'm getting the same issue as flashek. My php.ini is at /etc/hhvm/php.ini. It's not read by default. My HHVM is started like so:
hhvm --mode server -vServer.Type=fastcgi -vServer.Port=9000 --user NonRootUser --config /etc/hhvm/server.hdf
Where the NonRootUser is a system user with full access to the web directory and /home/hhvm/ where I store all my HHVM-related logs and whatnot.
This is my server.hdf file:
PidFile = /home/hhvm/run/pid
Server {
Port = 80
SourceRoot = /var/www/
DefaultDocument = index.php
IniFile = /etc/hhvm/php.ini
}
Log {
Level = Warning
AlwaysLogUnhandledExceptions = true
RuntimeErrorReportingLevel = 8191
UseLogFile = true
UseSyslog = false
File = /home/hhvm/logs/error.log
Access {
* {
File = /home/hhvm/logs/access.log
Format = %h %l %u % t \"%r\" %>s %b
}
}
}
Repo {
Central {
Path = /home/hhvm/hhvm.hhbc.sq3
}
}
#include "/usr/share/hhvm/hdf/static.mime-types.hdf"
StaticFile {
FilesMatch {
* {
pattern = .*\.(dll|exe)
headers {
* = Content-Disposition: attachment
}
}
}
Extensions : StaticMimeTypes
}
MySQL {
TypedResults = false
}
Eval {
Jit = true
}
Attempting to start HHVM gives me this:
Possible bad config node: Server.IniFile
I try to run this file:
<?php
var_dump(ini_get('date.timezone'));
$date = new DateTime();
from the command line like so:
hhvm -c /etc/hhvm/server.hdf test.php
and I get this:
Possible bad config node: Server.IniFile
string(0) ""
I'm running HHVM 3.0.1 from the hop5.in repo on CentOS 6.5 with Nginx 1.4.0.
Well, this is interesting. I just cloned the source for HHVM and did a search for IniFile -- figured I'd try to debug it. Guess what? IniFile isn't anywhere in the source. No wonder it's not working!