Uploaded image for project: 'Blesta Core'
  1. Blesta Core
  2. CORE-3082

CLI Installer may incorrectly set root_web_dir value

    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.

      1. 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
      2. 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
      3. 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
      4. 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.

        Activity

        Hide
        tyson Tyson Phillips (Inactive) added a comment -

        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:

        • 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
        • 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
          • Blesta should be able to recognize the correct Root Web Directory setting from the web server in the web browser, unless there are other configurations that could alter it
        • Update the System Status plugin to include a check on the system's Root Web Directory, and link to it if it appears to be inaccurate
        Show
        tyson Tyson Phillips (Inactive) added a comment - 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: 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 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 Blesta should be able to recognize the correct Root Web Directory setting from the web server in the web browser, unless there are other configurations that could alter it Update the System Status plugin to include a check on the system's Root Web Directory, and link to it if it appears to be inaccurate

          People

          • Assignee:
            tyson Tyson Phillips (Inactive)
            Reporter:
            admin Paul Phillips
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Fix Release Date:
              28/May/19

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 1 day, 2 hours, 17 minutes
              1d 2h 17m

                Agile