Question

WordPress can't write files on HHVM and nginx

https://caseypatrickdriscoll.com/questions-with-wordpress-on-nginx-and-hhvm/

Just posted this to the ‘Advanced WordPress’ Facebook group. Posting here for public archive. Will update.

Tech stack:

Ubuntu 14.04.1 nginx 0.91-ubuntu1 mysql 5.5.40-0ubuntu0.14.04.1 (Ubuntu) hhvm 3.5.0 (rel) WordPress 4.2.2 Any hhvm users here?

Superficial problem: auto updates to core, theme, plugins asks for FTP credentials. Same for uploading media. WordPress can’t write to server

Everything was running really well on my LEMP server until I needed to reboot my DO VPS last month. Still running well, but now simply can’t write files.

I currently (temporarily) have all mod permissions at 775 with www-data:www-data owner/group to root wp directory.

This is more a question of best practices running WP on hhvm. Is it all that different than running php-fpm?

From I can ‘sense’, it seems the hhvm process can’t write to the directories, as it either isn’t using the www-data user or part of the www-data group.

php5-fpm explicitly declares this in the /etc/php5/fpm/pool.d/www.conf file, but I can’t find a similar file or declaration for hhvm. There is a /etc/hhvm/ directory containing a php.ini and server.ini files, but currently there is no explicit user line in the files.

Upon further review in htop, it seems my ‘casey’ user owns the 6 hhvm processes. Do I just need to start hhvm as ‘www-data’? If this was the case, since ‘casey’ is a member of www-data, hhvm should be able to write to directories given the current 775 mod (but I might be mistaken about how that works). Regardless, the hhvm server process should obviously be owned by another user, but unclear what the best practice is here. If I recall, I manually booted hhvm after the server reboot, probably better to set up as a daemon.

Before I mess with the config files I want to make sure I’m relatively correct about this.

My google searches weren’t bringing up exact results on this. Am I headed in the right direction?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

By default on Ubuntu, HHVM does run under the www-data user. This is defined in the init script that is used to start the process. Here’s a snippet from /etc/init.d/hhvm:

# Default values. This values can be overwritten in '/etc/default/hhvm'
CONFIG_FILE="/etc/hhvm/server.ini"
SYSTEM_CONFIG_FILE="/etc/hhvm/php.ini"
RUN_AS_USER="www-data"
RUN_AS_GROUP="www-data"
ADDITIONAL_ARGS=""

As the comment notes, you can override these defaults by placing a file at /etc/default/hhvm with new values. You shouldn’t edit the init script directly. For more information on running HHVM on Ubuntu, check out: