Menu
  • HOME
  • TAGS

Change the value of a lexically scoped variable in a HHVM/Hack lambda expression?

lambda,closures,hhvm,lexical-scope,hacklang

Unfortunately Hack lambda expressions do not support this. However you can still fall back on PHP 5.3 closure syntax. function allTrue(Map<string, bool> $map): bool { $valid = 1; $map->map(function ($a) use (&$valid) { $valid &= $a; }); return $valid === 1; } $map = Map{'foo' => true, 'bar' => false...

Fatal error: f_imageloadfont is not supported: NYI in HHVM

php,gd,hhvm

The main part here is imageloadfont is not supported, which means calling it will cause a fatal error like the one you're seeing. You could open an issue about it to see if it can be implemented, or if the HNI definition can be removed so that a function_exists for...

HHVM - How to use hh_client properly

hhvm,hacklang

The editor bindings are probably what you want. Vim https://github.com/hhvm/vim-hack emacs https://github.com/facebook/hhvm/blob/master/hphp/hack/editor-plugins/emacs/hack-for-hiphop.el ...

Running hh_client on one file hangs forever

hhvm,hacklang

This might be a known problem: can you do killall -9 hh_server; export USER=$(logname) before trying again? If that fixes it, you've hit an issue I just fixed this week in https://github.com/facebook/hhvm/commit/53b4d9b1ad7ccf99ef7b80d5d673f1578c9791c8. That fix should be in the latest nightly build, so if you update your build, that might fix...

Nginx and HHVM always return a 404

php,nginx,hhvm

Replace the below HHVM conf with yours: location ~ \.(hh|php)$ { fastcgi_keep_conn on; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } Problem I see a space between $document_root and $fastcgi_script_name. Update Solved by changing $document_root with /var/www...

Nuclide IDE & Remote Server Setup with Watchman

hhvm,hacklang,watchman,nuclide-editor

It seems that Nuclide's WatchmanClient can't connect to your installed watchman for some reason. Note that the tests for WatchmanClient is currently disabled, but maybe it will show some useful error when you remove the x from line 20 of WatchmanClient-spec.js and run: npm test in the watchman-helpers directory or...

Libboost dependencies on Ubuntu 14.04 during HHVM install

ubuntu,hhvm,ubuntu-14.04

Those instructions are for Ubuntu 13.10. 14.04 has different requirements, so you should be following the instructions for Prebuilt 14.04 packages instead.

How do you format the HHVM error log output?

logging,nginx,hhvm,hiphop

This is currently hardcoded in hhvm's source. I highly recommend submitting a feature request to the hhvm team, they're a bunch of very helpful people. If you're not interested in that, you could pretty easily edit the timestamp call to include the offset, then rearrange the snprintf() lines to match...

What will happen if we use unsupported php in hhvm?

hhvm

The code will not work. The JIT isn't an addition to an existing PHP implementation. HHVM is a completely separate implementation, including differences in what will and won't run.

Error viewing images after enabling HHVM

magento,hhvm

I figured out the problem we had where the image disappeared when we enabled HHVM from control Panel. The problem is the memory limit in the .INI file was -1 and magneto GD2.php does not recognize -1 value in memory check function in GD2.php as in the code below (LINE...

What is the equivalent of http_get in hhvm?

hhvm

Functions like this marked as missing in HHVM are usually because the function is part of an extension that hasn't been implemented yet. The PHP.net docs say it's part of a PECL extension, pecl_http -- which doesn't look to be on by default even in PHP5 (although of course it...

array_merge for Maps and Vectors at hacklang

vector,map,hhvm,hacklang

Answering to my self. In fact array_merge is not listed under the list of functions with support for hack Collections. The best way to merge Vectors is the function addAll. <?hh $a = Vector {"qux"}; $b = Vector {"foo","bar"}; $a->addAll($b); var_dump($a); In the case of Map, it's a bit more...

hhvm-fastcgi + nginx how to make it display fatal errors in the browser

hhvm

You need to enable the configuration hhvm.server.implicit_flush in your php.ini, then you can send a response body in case of fatal errors. To be able to catch fatal errors with an error handler, you should also enable hhvm.error_handling.call_user_handler_on_fatals. For details, refer to the github issue on hhvm....

Execute Hackificator From PHP

ocaml,hhvm,hacklang

This means that hh_client executable was called and returned something other than "No errors!".

Stack overflow using hhvm for benchmarkgame adapted to strict Hack

php,stack-overflow,hhvm,hacklang

Your recursion will never hit a base case and stop as the values you're passing down while recursing will never be null. You probably want to exit if $depth is 0 as well as if it is null....

wordpress permalinks using hhvm

php,wordpress,apache,hhvm

This can be resolved with: DocumentRoot /var/www/myblog ProxyPassMatch ^/(.*.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/myblog/$1 ProxyPassMatch ^(?!\/wp\-admin\/)([^\.]+)$ fcgi://127.0.0.1:9000/var/www/myblog/index.php The first rule will serve the assets (images, css, etc) The second rule match all .php requests (for no permalinks, like wp-admin/ urls, etc) with the correct .php file (using hhvm) The third rule will match with...

HHVM outputs status code 200 on fatal errors and I can't use fastcgi_next_upstream because of that

wordpress,nginx,fastcgi,fatal-error,hhvm

I fixed this by injecting custom error handler for hhvm. My index.php for wordpress: <?php /** * HHVM outputs http status: 200 OK even on fatal errors. * Catch fatal errors on HHVM and put right response code. */ //Is this HHVM? if (defined('HHVM_VERSION')) { set_error_handler('catch_fatal_error_hhvm',E_ERROR); } function catch_fatal_error_hhvm() {...

HHVM non-deterministic behaviour of the typechecker

hhvm,hacklang

You are probably using an outdated version of HHVM. This problem sounds an awful lot like this race condition, which was fixed in HHVM 3.5.0 and newer (and was backported into the 3.3.3 LTS release). Notably, 3.4.x still had the bug. What version of HHVM are you using?...

Is it possible to hide sources under HHVM?

obfuscation,hhvm,code-security

@paulbliss: You could compile a bytecode repository and run that, but it's not something that would be difficult to reverse engineer. ... There isn't any great documentation on building repos. The wrapper script in tools/hhvm_wrapper.php has some useful shortcuts, you can look at the help options. There really isn't a...

Override properties of php for HHVM

travis-ci,hhvm

Create /etc/hhvm/php.ini, and put your settings in there.

phpinfo() not working correctly in HHVM

php,nginx,hhvm

No, this is correct. HHVM doesn't output anything yet than "HipHop". This was already reported 2010. https://github.com/facebook/hhvm/issues/172 https://github.com/facebook/hhvm/issues/1038 You could use this to see what your configuration is https://gist.github.com/ck-on/67ca91f0310a695ceb65...

Laravel 4.2 SuperClosure: Attempted to serialize unserializable builtin class Closure

laravel,hhvm

Turns out that happens if you try to serialize an Exception. (In this case, outputting it via Log::error("...", [$e]). Just stringify it and all is good.

hhvm won't change error_log ini setting at runtime

php,nginx,hhvm

Sorry, it is a bug. Follow along on the issue tracker to see when it is fixed (or even better, send us a PR to fix it).

HHVM fastcgi gives status code “500 OK” w

php,codeigniter,hhvm

CodeIgniter supresses warnings when making a database connection by prefixing the connect with an @ like; @mysqli_connect In HHVM this error is still registered as an error but it won't halt on it and just continues and it changes the status code to 500 OK...

preg_replace() /e modifier is deprecated for HHVM

php,regex,symfony-1.4,hhvm

You can try to use the sf 1.5. version maintained by guys from L'Express: https://github.com/LExpress/symfony1 (they have fixed the problem) If their changes are too much you can check how they managed to solve the 'e modifier' problem and copy their solution. Searching the code for use of pregtr it...

hhvm nginx not returning value for upload_max_filesize/post_max_size

php,nginx,hhvm

Sorry for the noise, but it looks like this is a bug. https://github.com/facebook/hhvm/issues/4993

Port 9000 not listed

ubuntu,nginx,fastcgi,hhvm,puphpet

The HHVM getting started wiki page indicates the likely solution to this. (I think it's also printed on the console when you apt-get install hhvm): sudo update-rc.d hhvm defaults ...

Receiving invalid filename error when converting first page of pdf to jpg

php,pdf,imagemagick,imagick,hhvm

OK...so the (kind of hacky) way to fix this in my situation is to use fopen() and then use setIteratorIndex(0) which is HIGLY unintuitive. But for those having the same problem...there you go! $pdf_handle = fopen('/path/to/file.pdf', 'rb'); $doc_preview = new Imagick(); $doc_preview->setResolution(180,180); $doc_preview->readImageFile($pdf_handle); $doc_preview->setIteratorIndex(0); $doc_preview->setImageFormat('jpeg'); $doc_preview->writeImage('/path/to/file.jpg'); $doc_preview->clear(); $doc_preview->destroy(); ...

HHVM staticly typing lookup tables and keeping them fully cached in RAM

hhvm

Okay I've solved my first question. I don't have any global scope issues. My require is being done from inside function main(), so it's as if the code from lookuptable####.php is being inserted into function main(). HHVM docs: "If the include occurs inside a function..." Basically if you were to...

Could not find driver MySQL with hhvm

php,mysql,pdo,laravel-4,hhvm

I think you have not installed php-mysql driver Try installing by using following command sudo apt-get install php5 php5-mysql ...

Did HHVM works only with HACK?

php,facebook,hhvm,hacklang

HHVM is a runtime engine for two programming languages, PHP and Hack. It is what actually executes your code and produces results, just like the Python interpreter or Node. When HHVM runs your PHP code, its behavior should be identical to running it on the PHP5 engine from php.net, the...

Wordpress on nginx can't create files

php,wordpress,nginx,hhvm

Nginx need nginx usergroup permission not apache permission. Nginx does not have permission to write. So give correct permission. Here is correct command. chown -R nginx:nginx /var/www/chefgrill.de This will allow nginx to write....

Disable typechecking from .hhconfig

typechecking,hhvm,hacklang

This is not supported. A Hack project is designed to be checked as a single project, with full analysis going across all of the different parts of it. If it doesn't typecheck as a whole, then the behavior of HHVM on it is undefined. You should really, really carefully consider...

HHVM: pthreads PHP classes

php,hhvm

ZTS is a prerequisite of pthreads. ZTS is not used as the default because ZTS mode has some overhead associated with it. The HHVM documentation is just a clone of the php-doc repository, restyled, with some additional sections added for HHVM, this is why the pthreads documentation shows up in...

HHVM not compiling JWT library as expected

hhvm

HHVM can't optimize code running at the top level (i.e., outside a function) very well. In the first example, most of the work is happening outside a function -- the "work" is the $sum += $i. Moving that into a function, your second example, allows HHVM to optimize it pretty...

Why does Magento remove my frontend cookie after using customer/session?

magento,cookies,nginx,session-cookies,hhvm

We solved this issue by adding the HHVM ini setting: hhvm.server.allow_duplicate_cookies = 0 More info: https://github.com/facebook/hhvm/issues/2758...

Add Elements to nullable Vector

arrays,vector,nullable,hhvm,hacklang

The easiest way would be to not use a nullable Vector. private Vector<string> $lines = Vector {}; gets around the need for a constructor too. Otherwise, you'll need to check if the value isn't null, then append to it: public function addLine(string $line): void { $vec = $this->lines; if ($vec...

HHVM + NGinx Connection refused

nginx,fastcgi,hhvm

I just realized the problem by myself. HHVM with its default setting without specifying the IP to listen, was only listening ipv6 addresses. Because of that i could connect with localhost but not with 127.0.0.1 Specifying the IP by hhvm.server.ip = 127.0.0.1 solved the problem....

How to Implement Singleton Pattern without Nullable

design-patterns,singleton,hhvm,hacklang

How do I assign a default value to a static property? If it's an object, like in this case, you can't. With primitives, you can do something like this: <?hh // strict class Foo { private static int $x = 0; // ... } However, for objects, you'd need...

Installing composer using vagrant, hhvm, and Ubuntu 14.04

ubuntu,vagrant,composer-php,hhvm,ubuntu-14.04

As a work around until this gets fixed in vagrant, hhvm or where ever the root cause exisits you can download the composer installer using wget: sudo wget https://getcomposer.org/installer Then install composer using hhvm with some options to extend the timeouts as recommended here. hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 installer...

Invalid operand type was used: array_uintersect expects array(s)

php,nginx,laravel-5,hhvm,array-intersect

This looks like a bug in HHVM. I took the liberty of filing an issue for you: https://github.com/facebook/hhvm/issues/5585 You can follow along there for more updates.

Phalcon Zephir vs APC vs HHVM Performance

php,apache,compilation,phalcon,hhvm

Zephir can't handle high level objective oriented code. Speed of your application will be worse than clean PHP way. Here you can find comparsion of clean PHP vs Zephir. https://github.com/dgafka/zephir-BookStore So, if you want to rewrite your application to zephir, think twice before you will do it. https://github.com/phalcon/zephir/issues/694#issuecomment-67987616...

I can not run HHVM on CentOS

centos,hhvm

Where is your HHVM pid file configured to live? In /etc/hhvm/server.hdf or similar, do you have a PidFile = setting? I set mine to PidFile = /var/run/hhvm/pid. I then did a mkdir /var/run/hhvm....