apachemod-rewritedrupal-7ubuntu-18.04hhvm

HHVM 3.21 in repo authoritative mode, Drupal 7, mod_rewrite problem


I am trying an experiment to bring up a Drupal 7 installation in Repo authoritative mode under HHVM 3.21 (which still supported PHP - latest version does not). (May sound crazy, but bear with me here.) Server is Ubuntu 18.04 running apache2 with mod_proxy, mod_proxy_fcgi. I am new to HHVM, so I have probably made an obvious mistake.

I started with an index.php "hello world" to ensure that I had the general configuration working. That works fine, regardless of the contents of /var/www/html/index.php (per https://docs.hhvm.com/hhvm/advanced-usage/repo-authoritative)

I am using hhvm --hphp -thhbc -o /var/cache/hhvm file_list.txt to create the repo, which is then chown'ed to www-data. (The same file I copy to /var/www/.hhvm.hhbc, since it seems that the server wants a copy there... this question I will solve later...)

Problem #1: I have left the entire file tree in place in /var/www/html, but mod_rewrite is not working correctly. I can use the site without problems if I use the "unpretty" URLs (?q=admin/config), but not rewritten URLs.

Problem #2: In principle HHVM in repo authoritative mode should be able to serve the entire image from the repo file if only the index.php is in place or if I specify hhvm.server.allowed_files[] = index.php, but when I try this, the server 404's.

What follows is a ton of relevant info from config files. I am happy to add more information as needed to assist with finding my error/omission, in case I have forgotten anything here. Thank you for reading this far!

/etc/hhvm/server.ini:

hhvm.server.port = 9000
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.server.source_root = /var/www/html

hhvm.log.use_log_file = false
hhvm.log.use_syslog = true
hhvm.repo.authoritative=true
hhvm.repo.path = /var/cache/hhvm/hhvm.hhbc

hhvm.log.level = Verbose
hhvm.server.allowed_files[] = index.php

VirtualHost:

<VirtualHost *:80>
        ProxyPass / fcgi://127.0.0.1:9000/var/www/html/
        ProxyPassReverse / fcgi://localhost:9000/
        DocumentRoot /var/www/html
</VirtualHost>

settings.php:

// Lots of standard stuff, then...
$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'dbnamehere',
      'username' => 'usernamehere',
      'password' => 'passwordhere',
      'host' => 'localhost',
      'port' => '3306',
      'driver' => 'mysql',
      'prefix' => '',
      'unix_socket' => '/var/run/mysqld/mysqld.sock',   // necessary for hhvm - otherwise it tries /dev/null
    ),
  ),
);
$base_url = 'http://korolev';
$conf['reverse_proxy'] = TRUE;
$conf['reverse_proxy_addresses'] = array('192.168.1.75', '127.0.0.1', '127.0.0.1:9000'); // Grasping at straws here, but still not working

.htaccess:

# Standard stuff here, except for the following uncommented
  RewriteBase /

/var/log/apache2/error.log for http://korolev?q=node/add which works fine (LogLevel debug):

[Thu Nov 04 13:18:40.490054 2021] [authz_core:debug] [pid 26205] mod_authz_core.c(835): [client 192.168.1.54:39208] AH01628: authorization result: granted (no directives)
[Thu Nov 04 13:18:40.490150 2021] [proxy_fcgi:debug] [pid 26205] mod_proxy_fcgi.c(109): [client 192.168.1.54:39208] AH01060: set r->filename to proxy:fcgi://127.0.0.1:9000/var/www/html/
[Thu Nov 04 13:18:40.490186 2021] [proxy:debug] [pid 26205] mod_proxy.c(1229): [client 192.168.1.54:39208] AH01143: Running scheme fcgi handler (attempt 0)
[Thu Nov 04 13:18:40.490202 2021] [proxy_fcgi:debug] [pid 26205] mod_proxy_fcgi.c(995): [client 192.168.1.54:39208] AH01076: url: fcgi://127.0.0.1:9000/var/www/html/ proxyname: (null) proxyport: 0
[Thu Nov 04 13:18:40.490220 2021] [proxy_fcgi:debug] [pid 26205] mod_proxy_fcgi.c(1002): [client 192.168.1.54:39208] AH01078: serving URL fcgi://127.0.0.1:9000/var/www/html/
[Thu Nov 04 13:18:40.490233 2021] [proxy:debug] [pid 26205] proxy_util.c(2191): AH00942: FCGI: has acquired connection for (127.0.0.1)
[Thu Nov 04 13:18:40.490255 2021] [proxy:debug] [pid 26205] proxy_util.c(2244): [client 192.168.1.54:39208] AH00944: connecting fcgi://127.0.0.1:9000/var/www/html/ to 127.0.0.1:9000
[Thu Nov 04 13:18:40.490277 2021] [proxy:debug] [pid 26205] proxy_util.c(2453): [client 192.168.1.54:39208] AH00947: connected /var/www/html/ to 127.0.0.1:9000
[Thu Nov 04 13:18:40.490436 2021] [proxy:debug] [pid 26205] proxy_util.c(2922): AH02824: FCGI: connection established with 127.0.0.1:9000 (127.0.0.1)
[Thu Nov 04 13:18:41.438056 2021] [proxy:debug] [pid 26205] proxy_util.c(2206): AH00943: FCGI: has released connection for (127.0.0.1)

error file for http://korolev/node/add which 404's:

[Thu Nov 04 13:19:46.248220 2021] [authz_core:debug] [pid 26206] mod_authz_core.c(835): [client 192.168.1.54:39348] AH01628: authorization result: granted (no directives)
[Thu Nov 04 13:19:46.248312 2021] [proxy_fcgi:debug] [pid 26206] mod_proxy_fcgi.c(109): [client 192.168.1.54:39348] AH01060: set r->filename to proxy:fcgi://127.0.0.1:9000/var/www/html/node/add
[Thu Nov 04 13:19:46.248346 2021] [proxy:debug] [pid 26206] mod_proxy.c(1229): [client 192.168.1.54:39348] AH01143: Running scheme fcgi handler (attempt 0)
[Thu Nov 04 13:19:46.248360 2021] [proxy_fcgi:debug] [pid 26206] mod_proxy_fcgi.c(995): [client 192.168.1.54:39348] AH01076: url: fcgi://127.0.0.1:9000/var/www/html/node/add proxyname: (null) proxyport: 0
[Thu Nov 04 13:19:46.248373 2021] [proxy_fcgi:debug] [pid 26206] mod_proxy_fcgi.c(1002): [client 192.168.1.54:39348] AH01078: serving URL fcgi://127.0.0.1:9000/var/www/html/node/add
[Thu Nov 04 13:19:46.248405 2021] [proxy:debug] [pid 26206] proxy_util.c(2191): AH00942: FCGI: has acquired connection for (127.0.0.1)
[Thu Nov 04 13:19:46.248418 2021] [proxy:debug] [pid 26206] proxy_util.c(2244): [client 192.168.1.54:39348] AH00944: connecting fcgi://127.0.0.1:9000/var/www/html/node/add to 127.0.0.1:9000
[Thu Nov 04 13:19:46.248431 2021] [proxy:debug] [pid 26206] proxy_util.c(2453): [client 192.168.1.54:39348] AH00947: connected /var/www/html/node/add to 127.0.0.1:9000
[Thu Nov 04 13:19:46.248567 2021] [proxy:debug] [pid 26206] proxy_util.c(2922): AH02824: FCGI: connection established with 127.0.0.1:9000 (127.0.0.1)
[Thu Nov 04 13:19:46.249166 2021] [proxy:debug] [pid 26206] proxy_util.c(2206): AH00943: FCGI: has released connection for (127.0.0.1)
[Thu Nov 04 13:19:46.423142 2021] [authz_core:debug] [pid 26206] mod_authz_core.c(835): [client 192.168.1.54:39348] AH01628: authorization result: granted (no directives), referer: http://korolev/node/add
[Thu Nov 04 13:19:46.423213 2021] [proxy_fcgi:debug] [pid 26206] mod_proxy_fcgi.c(109): [client 192.168.1.54:39348] AH01060: set r->filename to proxy:fcgi://127.0.0.1:9000/var/www/html/favicon.ico, referer: http://korolev/node/add
[Thu Nov 04 13:19:46.423242 2021] [proxy:debug] [pid 26206] mod_proxy.c(1229): [client 192.168.1.54:39348] AH01143: Running scheme fcgi handler (attempt 0), referer: http://korolev/node/add
[Thu Nov 04 13:19:46.423258 2021] [proxy_fcgi:debug] [pid 26206] mod_proxy_fcgi.c(995): [client 192.168.1.54:39348] AH01076: url: fcgi://127.0.0.1:9000/var/www/html/favicon.ico proxyname: (null) proxyport: 0, referer: http://korolev/node/add
[Thu Nov 04 13:19:46.423271 2021] [proxy_fcgi:debug] [pid 26206] mod_proxy_fcgi.c(1002): [client 192.168.1.54:39348] AH01078: serving URL fcgi://127.0.0.1:9000/var/www/html/favicon.ico, referer: http://korolev/node/add
[Thu Nov 04 13:19:46.423286 2021] [proxy:debug] [pid 26206] proxy_util.c(2191): AH00942: FCGI: has acquired connection for (127.0.0.1)
[Thu Nov 04 13:19:46.423313 2021] [proxy:debug] [pid 26206] proxy_util.c(2244): [client 192.168.1.54:39348] AH00944: connecting fcgi://127.0.0.1:9000/var/www/html/favicon.ico to 127.0.0.1:9000, referer: http://korolev/node/add
[Thu Nov 04 13:19:46.423329 2021] [proxy:debug] [pid 26206] proxy_util.c(2453): [client 192.168.1.54:39348] AH00947: connected /var/www/html/favicon.ico to 127.0.0.1:9000, referer: http://korolev/node/add
[Thu Nov 04 13:19:46.423489 2021] [proxy:debug] [pid 26206] proxy_util.c(2922): AH02824: FCGI: connection established with 127.0.0.1:9000 (127.0.0.1)
[Thu Nov 04 13:19:46.424103 2021] [proxy:debug] [pid 26206] proxy_util.c(2206): AH00943: FCGI: has released connection for (127.0.0.1)

/var/log/apache2/error.log for source tree not present (problem #2):

[Thu Nov 04 14:56:41.403439 2021] [authz_core:debug] [pid 26207] mod_authz_core.c(835): [client 192.168.1.54:51356] AH01628: authorization result: granted (no directives)
[Thu Nov 04 14:56:41.403526 2021] [proxy_fcgi:debug] [pid 26207] mod_proxy_fcgi.c(109): [client 192.168.1.54:51356] AH01060: set r->filename to proxy:fcgi://127.0.0.1:9000/var/www/html/
[Thu Nov 04 14:56:41.403560 2021] [proxy:debug] [pid 26207] mod_proxy.c(1229): [client 192.168.1.54:51356] AH01143: Running scheme fcgi handler (attempt 0)
[Thu Nov 04 14:56:41.403575 2021] [proxy_fcgi:debug] [pid 26207] mod_proxy_fcgi.c(995): [client 192.168.1.54:51356] AH01076: url: fcgi://127.0.0.1:9000/var/www/html/ proxyname: (null) proxyport: 0
[Thu Nov 04 14:56:41.403590 2021] [proxy_fcgi:debug] [pid 26207] mod_proxy_fcgi.c(1002): [client 192.168.1.54:51356] AH01078: serving URL fcgi://127.0.0.1:9000/var/www/html/
[Thu Nov 04 14:56:41.403605 2021] [proxy:debug] [pid 26207] proxy_util.c(2191): AH00942: FCGI: has acquired connection for (127.0.0.1)
[Thu Nov 04 14:56:41.403620 2021] [proxy:debug] [pid 26207] proxy_util.c(2244): [client 192.168.1.54:51356] AH00944: connecting fcgi://127.0.0.1:9000/var/www/html/ to 127.0.0.1:9000
[Thu Nov 04 14:56:41.403637 2021] [proxy:debug] [pid 26207] proxy_util.c(2453): [client 192.168.1.54:51356] AH00947: connected /var/www/html/ to 127.0.0.1:9000
[Thu Nov 04 14:56:41.403762 2021] [proxy:error] [pid 26207] (111)Connection refused: AH00957: FCGI: attempt to connect to 127.0.0.1:9000 (127.0.0.1) failed
[Thu Nov 04 14:56:41.403807 2021] [proxy_fcgi:error] [pid 26207] [client 192.168.1.54:51356] AH01079: failed to make connection to backend: 127.0.0.1
[Thu Nov 04 14:56:41.403820 2021] [proxy:debug] [pid 26207] proxy_util.c(2206): AH00943: FCGI: has released connection for (127.0.0.1)

/var/log/syslog from problem #2:

Nov  4 15:20:45 korolev hhvm: Warming up
Nov  4 15:20:45 korolev hhvm: BootStats: warmup done, took 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: enable_numa done, took 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:45 korolev hhvm: page server started
Nov  4 15:20:45 korolev hhvm: BootStats: servers started done, took 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:45 korolev hhvm: all servers started
Nov  4 15:20:45 korolev hhvm: BootStats: all done, took 284ms wall, 242ms cpu, 124 MB RSS total
Nov  4 15:20:45 korolev hhvm: BootStats: ExecutionContext = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: ExtensionRegistry::moduleInit = 159ms wall, 127ms cpu, 7 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: PageletServer::Restart = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: Process::InitProcessStatics = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: Stream::RegisterCoreWrappers = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: TOTAL = 284ms wall, 242ms cpu, 124 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: XboxServer::Restart = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: apc_load = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: enable_numa = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: extra_process_init = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: extra_process_init_concurrent_wait = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: g_vmProcessInit = 65ms wall, 57ms cpu, 15 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: loading static content = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: mapping self = 50ms wall, 50ms cpu, 100 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: onig_init = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: pagein_self = 50ms wall, 50ms cpu, 100 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: pcre_reinit = 2ms wall, 2ms cpu, 0 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: pthread_init = 2ms wall, 1ms cpu, 2 MB RSS
Nov  4 15:20:45 korolev hhvm: BootStats: rds::requestExit = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:46 korolev hhvm: BootStats: servers started = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:46 korolev hhvm: BootStats: timezone_init = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:46 korolev hhvm: BootStats: warmup = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:46 korolev hhvm: BootStats: xenon = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:20:46 korolev hhvm: BootStats: xmlInitParser = 0ms wall, 0ms cpu, 0 MB RSS
Nov  4 15:21:04 korolev hhvm: perf_event_open failed with: Permission denied
Nov  4 15:21:04 korolev hhvm: message repeated 2 times: [ perf_event_open failed with: Permission denied]
Nov  4 15:21:04 korolev hhvm: receiving index.php
Nov  4 15:21:04 korolev hhvm: receiving install.php

(Weird that index.php is redirecting to install.php?)


Solution

  • What I understand is that there is no current (free, open source) means for "compiling" PHP. This means that if we do not want to give source code for a key algorithm to a client, either we subscribe to one of the proprietary PHP compilers or move out of PHP.

    So we have decided to move all algorithm work to Java.