New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WordPress 4.6 - Fatal Error: Uncaught phpmailerException #123

Closed
evansvince opened this Issue Aug 25, 2016 · 5 comments

Comments

Projects
None yet
5 participants
@evansvince

evansvince commented Aug 25, 2016

The latest version of Wordpress (4.6) and Valet causes a fatal error on step 2 of installing wordpress. The error is "Fatal error: Uncaught phpmailerException: Invalid address: wordpress@....".

This error occurs because WP expects the $_SERVER['SERVER_NAME'] to be set in order to create the $from_email variable. See wp-includes/pluggable.php ~line 326.

By default, Valet does not set the $_SERVER['SERVER_NAME']. Run phpinfo() and you will see no value.

To fix this issue:

In ~/.composer/vendor/laravel/valet/clu/drivers/WordPressValetDriver.php, within the frontControllerPath, add the following:

$_SERVER['SERVER_NAME'] = $siteName.'.dev'

That's assuming you are using the .dev TLD. If not, change it to whatever you are using.

Run valet restart.

@jastuccio

This comment has been minimized.

Show comment
Hide comment
@jastuccio

jastuccio Sep 1, 2016

This fixed my problem. Here is the function, including the new line.

/**
     * 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)
    {
        $_SERVER['PHP_SELF']    = $uri;
        $_SERVER['SERVER_ADDR'] = '127.0.0.1';
        $_SERVER['SERVER_NAME'] = $siteName.'.dev';

        return parent::frontControllerPath(
            $sitePath, $siteName, $this->forceTrailingSlash($uri)
        );
    }

jastuccio commented Sep 1, 2016

This fixed my problem. Here is the function, including the new line.

/**
     * 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)
    {
        $_SERVER['PHP_SELF']    = $uri;
        $_SERVER['SERVER_ADDR'] = '127.0.0.1';
        $_SERVER['SERVER_NAME'] = $siteName.'.dev';

        return parent::frontControllerPath(
            $sitePath, $siteName, $this->forceTrailingSlash($uri)
        );
    }
@victorhguillen

This comment has been minimized.

Show comment
Hide comment
@victorhguillen

victorhguillen Sep 7, 2016

Perfect it works. Thanks.

victorhguillen commented Sep 7, 2016

Perfect it works. Thanks.

@robertbiswas

This comment has been minimized.

Show comment
Hide comment
@robertbiswas

robertbiswas Sep 11, 2016

Yeah. It works for me too! Thank you.

robertbiswas commented Sep 11, 2016

Yeah. It works for me too! Thank you.

@adamwathan

This comment has been minimized.

Show comment
Hide comment
@adamwathan

adamwathan Sep 24, 2016

Member

Fixed in 353f24c

Member

adamwathan commented Sep 24, 2016

Fixed in 353f24c

@adamwathan adamwathan closed this Sep 24, 2016

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Nov 11, 2016

Super helpful. Thanks for the fix.

ghost commented Nov 11, 2016

Super helpful. Thanks for the fix.

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