Laravel Valet不适用于wp-admin,错误500或无法声明类WordPressValetDriver

时间:2019-03-24 10:18:52

标签: wordpress laravel laravel-valet

在Mac OS X上使用Laravel Valet 2.2和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

0 个答案:

没有答案