Articles in this section

Unable to detect Laravel instance for domain: no error shown in Plesk

Plesk for Linux kb: technical

Applicable to:

  • Plesk for Linux

Symptoms

  • In Plesk, after clicking Scan in the menu Domains > example.com > Laravel, no application is shown, despite the fact that in the progress window it is shown that the application was detected.
  • All required files are present for a domain, the root directory is configured correctly, and in the Laravel Toolkit extension database /usr/local/psa/var/modules/laravel/laravel_toolkit.sqlite3, the information about the application is present and correct.
  • With debug enabled, the following error is found in the log file /var/log/plesk/panel.log:

    CONFIG_TEXT: Exception: PHP Warning: Trying to access array offset on null; File: /usr/local/psa/admin/plib/modules/laravel/library/Service/Laravel.php, Line: 205
    file: /usr/local/psa/admin/plib/Smb/Exception/Syntax.php 
    line: 55 
    Trying to access array offset on null in /usr/local/psa/admin/plib/modules/laravel/library/Service/Laravel.php on line 205 
    ERR [panel] array_filter(): Argument #1 ($array) must be of type array, null given

    Prior to the error, it can be seen that the artisan command either has empty output or its output starts with anything else other than the symbol {, for example:

    CONFIG_TEXT: DEBUG [extension/laravel] [689f8ba25fece] Starting: /usr/local/psa/admin/bin/filemng johndoe exec /var/www/vhosts/example.com/httpdocs '/opt/plesk/php/8.1/bin/php' 'artisan' 'list' '--format=json', stdin:
    DEBUG [extension/laravel] [689f8ba25fece] Finished in 0.38964s, Error code: 0, stdout: ,{"application":{"name":"Laravel Framework","version":"8.83.29"},..........

Cause

Either infected website files, or due to the application code, the artisan output is corrupted by extra symbols in the beginning (for example, in the file routes/console.php of the application, there is the extra symbol before <?php.

The lack of error reporting in the Plesk interface is registered as a Laravel extension bug EXTPLESK-8981.

Resolution

  1. Connect to the server via SSH
  2. Get into the website's folder:

    # cd /var/www/vhosts/example.com/httpdocs

  3. Find the infected file and remove the symbols:

    # grep -rlI $'\xEF\xBB\xBF' app bootstrap config routes
    routes/web.php

    # sed -i '1s/^\xEF\xBB\xBF//' routes/web.php

The Laravel instance for the domain should be autodetected after that.

Was this article helpful?

Comments

2 comments
Date Votes
  • Those don't work at all, the problem lies in the format output, artisan return all formats but json; my problem begins with the last update

    0
  • Hi Alberto García Gómez 

    If this is happening as of last update this article solution may not apply for your situation.

    Please open a ticket and I will be happy to take a look.

    0

Please sign in to leave a comment.