Skip to content

Pre-check existence of index.php in docroot on ddev start and warn (for non-generic projects) #7157

Closed

Description

@rfay

Is your feature request related to a problem?

People often get a 403 when they have the wrong docroot or no index.php in the docroot. We have this in our FAQ.

Describe your solution

@dalin suggested that we do a check-and-warn during ddev start if there is no index.php in the specified docroot. We could save people a lot of trouble.

Describe alternatives

No response

Additional context

No response

Activity

  1. dalin- commented on Mar 27, 2025

    @dalin-

    There may be other useful pre-flight checks too. This one is fundamentally something like this during ddev start

    #!/usr/bin/env bash
    
    DOCROOT=$1
    
    # Find the real path to the docroot.  Especially useful when the docroot is empty.
    REALDOCROOT=$( readlink -f "./$DOCROOT" )
    
    if [ ! -d "$REALDOCROOT" ]; then 
      echo "The docroot '$DOCROOT' does not exist at '$REALDOCROOT'. You'll likely get a 403 error when trying to visit this site in your browser.  Please see '.ddev/config.yaml' for details."  >&2
      exit 1
    fi
    
    if test -z "$(find "$REALDOCROOT" -maxdepth 1 -name 'index.*' -print -quit)"; then
      echo "There was no index.php, index.html or similar file found in docroot '$DOCROOT' at '$REALDOCROOT'. You'll likely get a 403 error when trying to visit this site in your browser.  Please see '.ddev/config.yaml' for details." >&2
      # Maybe continue flow here, treating the above only as a warning???
    fi
  2. ChloeSartorelli commented on Apr 1, 2025

    @ChloeSartorelli
    Contributor

    Hopefully goes without saying but just in case: this warning should not happen for the generic project type.

    On the other side of the coin, there might be other pre-flight checks that are project-type specific which would be appropriate.

  3. added this to the v1.24.5 milestone on Apr 1, 2025
  4. changed the title [-]Pre-check existence of index.php in docroot on `ddev start` and warn[/-] [+]Pre-check existence of index.php in docroot on `ddev start` and warn (for non-generic projects)[/+] on Apr 1, 2025
  5. deleted a comment from on Apr 16, 2025
  6. added a commit that references this issue on Apr 24, 2025
    762a97e
  7. added a commit that references this issue on Apr 25, 2025
    512c961
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions