Skip to content

Unclear path for Mobile_Detect.php #5

Description

@chaosarium

Describe the bug
Reading a text might result in this error:

[Mon Jan 10 17:40:52 2022] PHP 7.4.12 Development Server (http://localhost:9004) started
[Mon Jan 10 17:40:54 2022] [::1]:53495 Accepted
[Mon Jan 10 17:40:54 2022] [::1]:53495 [500]: GET /do_text.php?start=1 - require_once(): Failed opening required 'vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php' (include_path='.:/Applications/MAMP/bin/php/php7.4.12/lib/php') in /Users/username/vendor/hugofara/lwt/do_text.php on line 15
[Mon Jan 10 17:40:54 2022] [::1]:53495 Closing

To Reproduce
(I'm not sure if this is the proper way to set up lwt. But since MAMP doesn't come with composer, I followed this guide and put composer.phar in ~/

  1. composer require hugofara/lwt
  2. Start PHP development server from VSCode. Everything seems to work fine until making a request to do_text.php or do_test.php
  3. Read a text, which results in a blank web page

Expected behavior
lwt automatically finds the right Mobile_Detect.php.

Screenshots
Essentially blank web page:
image

Desktop (please complete the following information):

  • OS: MacOS 12.0.1
  • Browser: Safari
  • PHP 7.4.12
  • MySQL 5.7.32

Additional context
Specifying the absolute path to Mobile_Detect.php fixes the issue, but I'm sure this isn't the most elegant solution.

require_once '/Users/username/vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php'; // (was 'vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php';)

Since composer installs both mobiledetect/mobiledetectlib and hugofara/lwt in vendor/, this also works

require_once '../../mobiledetect/mobiledetectlib/Mobile_Detect.php'; // (was 'vendor/mobiledetect/mobiledetectlib/Mobile_Detect.php';)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdocumentationImprovements or additions to documentation

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions