FAQ

Configuration page not working on dev environments

How to reproduce: When clicking on the Show Info button on the toolbar, the opened page does not show Hdiv configuration.

The problem is that Apache/FPM configuration is not redirecting the request to your PHP Document root.

There are many ways of solving this problem. It will depend on your server configuration. One approach when using Apache could be:

#Apache configuration file
<Directory /var/www/html/yourApp>
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</Directory>

SELinux

When using SELinux, there are extra steps required in order to let your app interact with Hdiv.

Following the proposed paths on the installation page, it is required: - Path /opt/hdiv has a policy which allow executing everything under that folder. - Path /opt/hdiv/php_agent/config has a policy which allow creating files/folders.

One example using Apache policies could be:

semanage fcontext -a -t httpd_sys_script_exec_t "/opt/hdiv(/.*)?"
restorecon -R -v /opt/hdiv
semanage fcontext -a -t httpd_sys_rw_content_t "/opt/hdiv/php_agent/config(/.*)?"
restorecon -R /opt/hdiv/php_agent/config

In addition to apply the previous policies to those two folders, it is also required that the selected policies have permission for the following: (In order to make it easier to understand, the example keeps using Apache policies)

module hdiv 1.0;

require {
    type cgroup_t;
    type proc_net_t;
    type unreserved_port_t;
    type httpd_t;
    type httpd_sys_script_t;
    type http_port_t;
    class tcp_socket { accept listen name_bind name_connect };
    class dir search;
    class file { getattr open read };
}

#============= httpd_sys_script_t ==============
allow httpd_sys_script_t cgroup_t:dir search;
allow httpd_sys_script_t cgroup_t:file { getattr open read };

#!!!! This avc can be allowed using one of the these booleans:
#     httpd_can_network_connect, nis_enabled
allow httpd_sys_script_t http_port_t:tcp_socket name_connect;
allow httpd_sys_script_t proc_net_t:file { open read };

#!!!! This avc can be allowed using one of the these booleans:
#     httpd_can_network_connect, nis_enabled
allow httpd_sys_script_t self:tcp_socket { accept listen };

#!!!! This avc can be allowed using the boolean 'nis_enabled'
allow httpd_sys_script_t unreserved_port_t:tcp_socket { name_bind name_connect };

#============= httpd_t ==============

#!!!! This avc can be allowed using one of the these booleans:
#     httpd_can_network_connect, nis_enabled
allow httpd_t unreserved_port_t:tcp_socket name_connect;

How to troubleshoot problems on installation

If you followed all the steps in installation page and you can´t see your application on the console or neither the toolbar, you can enable the setup mode which will help you understand where the problem is.

In order to do so, you have modes:

  • Log: This mode will check your setup on every request and send a summary of errors and solutions to the log. In order to enable this method, set the key php.setup.mode = "LOG". The log will look like:

Setup mode log

  • Html: This mode will intercept any request to your app and display a summary of errors/solutions on the browser. This mode is not suitable for production servers. In order to enable this method, set the key php.setup.mode = "HTML". The summary will look like:

Setup mode html

On either of the options, the information will show you where the problems are and how to solve them. Once they are resolved, do another request and check the summary until it says all is looking good.

Once you finish debugging the setup, turn of the setup mode in order to avoid impacting performance. In order to do so, set the following php.setup.mode = "OFF".