Details
-
Type: Story
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 4.5.2
-
Fix Version/s: 4.6.0-b1
-
Component/s: Staff Interface
-
Labels:None
Description
The CLI installer cannot determine the document root to set as Blesta's "Root Web Directory" setting because php is unable to determine this value without the web server providing it.
- In the CLI installer, add an argument to set the document root, e.g. "docroot", which should be a valid absolute path
- If the argument is not provided, the current behavior takes place, and the system determines the path from the current working directory
- Update the documentation/example for CLI installs to describe running the install script from the document root on the server
- Also update the example in the install template in Blesta to specify the install command for CLI
- Update the system settings in Blesta to add a check next to the Root Web Directory setting that displays a note if Blesta thinks the value set is incorrect
- Update the System Status plugin to include a check on the system's Root Web Directory, and link to that page if it appears to be inaccurate
This value is important, so perhaps a value of 40 to 50 should be taken off for an invalid/inaccurate path
When installing Blesta, we add a value to the settings table where settings.key="root_web_dir" to the document root. This setting is available in the UI under Settings > System > General for Root Web Dir.
However, when installing via CLI, this path is incorrect if Blesta is not installed in the document root. For example, if we install Blesta at domain.com/billing/ and the path to this directory is /home/domain/public_html/billing/ this setting should be set to "/home/domain/public_html/" which is the document root. It is not necessarily the full path to Blesta.
UI installer works fine, it's only an issue with the CLI installer.
In CLI-mode, Blesta cannot determine the server's document root since that is only available by the web server. This is why the Root Web Directory setting exists in Blesta since CORE-716. Blesta can only determine its own root web directory. It relies on php to provide the relative script path (i.e. SCRIPT_NAME or PHP_SELF), and then removes that from the absolute root web directory to determine the document root. In CLI-mode, SCRIPT_NAME and PHP_SELF are relative to the current working directory. Therefore, the only way for Blesta to set the correct root_web_directory setting on CLI install is if it is installed from the server's document root.
e.g.
If Blesta is installed at /var/home/www/billing/, and the web document root is /var/home/www/, then you must cd to /var/home/www/ and run the install script from there:
>cd /var/home/www/ >php ./billing/index.php install
..only then would the root_web_dir be set accurately.
What might be good to do is: