Laravel Valet не работает для wp-admin с ошибкой 500 или не может объявить класс WordPressValetDriver - PullRequest
0 голосов
/ 24 марта 2019

На одной установке с Laravel Valet 2.2 на Mac OS X, с PHP 7.3.3 я не могу использовать mysite.test / wp-admin

2019/03/24 11:01:34 [error] 43657#0: *1 rewrite or internal redirection cycle while internally redirecting to "/41c270e4-5535-4daa-b23e-c269744c2f45/Users/abkrim/Sites/castris/public/wp-admin/index.php" while reading response header from upstream, client: 127.0.0.1, server: castris.test, request: "GET /wp-admin/ HTTP/2.0", upstream: "fastcgi://unix:/Users/abkrim/.config/valet/valet.sock", host: "castris.test"

Если попытаться создать пользовательский диск для WordPress, получите другую ошибку на всем сайте.

/ Users / abkrim / .config / valet / Drivers / WordPressValetDriver.php

<?php

class WordPressValetDriver extends ValetDriver
{
    /**
     * Determine if the driver serves the request.
     *
     * @param  string  $sitePath
     * @param  string  $siteName
     * @param  string  $uri
     * @return bool
     */
    public function serves($sitePath, $siteName, $uri)
    {
        // if (file_exists($sitePath.'/file-that-identifies-my-framework')) {
        //     return true;
        // }

    return is_dir($sitePath.'/wp-admin');

        //return false;
    }

    /**
     * Determine if the incoming request is for a static file.
     *
     * @param  string  $sitePath
     * @param  string  $siteName
     * @param  string  $uri
     * @return string|false
     */
    public function isStaticFile($sitePath, $siteName, $uri)
    {
        if (file_exists($staticFilePath = $sitePath.'/public/'.$uri)) {
            return $staticFilePath;
        }

        return false;
    }

    /**
     * Get the fully resolved path to the application's front controller.
     *
     * @param  string  $sitePath
     * @param  string  $siteName
     * @param  string  $uri
     * @return string
     */
    public function frontControllerPath($sitePath, $siteName, $uri)
    {
        return $sitePath.'/public/index.php';
    }
}

Ошибка

Fatal error: Cannot declare class WordPressValetDriver, because the name is already in use in /Users/abkrim/.config/valet/Drivers/WordPressValetDriver.php on line 53
...