• Resolved eahrenee

    (@eahrenee)


    I can’t access wp-admin, below is the whole error.
    I get this error if I am using PHP 8.0 or newer

    PHP Fatal error: Uncaught ValueError: setcookie(): “path” option cannot contain “,”, “;”, ” “, “\t”, “\r”, “\n”, “\013”, or “\014″ in /home/worcest/staging.worcestervt.org/wp-login.php:531 Stack trace: #0 /home/worcest/staging.worcestervt.org/wp-login.php(531): setcookie(‘wordpress_test_…’, ‘WP Cookie check’, 0, ‘/wp\r\n\r\n/’, ”, true, true) #1 {main} thrown in /home/worcest/staging.worcestervt.org/wp-login.php on line 531

    If I set php to 7.4, I can get the login screen and log in, but the error log shows the following error

    [15-May-2025 14:17:37 UTC] PHP Warning: Cookie paths cannot contain any of the following ‘,; \t\r\n\013\014’ in /home/worcest/staging.worcestervt.org/wp-login.php on line 531 [15-May-2025 14:17:37 UTC] PHP Warning: Cookie paths cannot contain any of the following ‘,; \t\r\n\013\014’ in /home/worcest/staging.worcestervt.org/wp-includes/pluggable.php on line 1141 [15-May-2025 14:17:37 UTC] PHP Warning: Cookie paths cannot contain any of the following ‘,; \t\r\n\013\014’ in /home/worcest/staging.worcestervt.org/wp-includes/pluggable.php on line 1149 [15-May-2025 14:17:37 UTC] PHP Warning: Cookie paths cannot contain any of the following ‘,; \t\r\n\013\014’ in /home/worcest/staging.worcestervt.org/wp-includes/pluggable.php on line 1151 [15-May-2025 14:17:37 UTC] PHP Warning: Cookie paths cannot contain any of the following ‘,; \t\r\n\013\014’ in /home/worcest/staging.worcestervt.org/wp-includes/pluggable.php on line 1155 [15-May-2025 14:17:37 UTC] PHP Warning: Cookie paths cannot contain any of the following ‘,; \t\r\n\013\014’ in /home/worcest/staging.worcestervt.org/wp-includes/pluggable.php on line 1156 [15-May-2025 14:17:37 UTC] PHP Warning: Cookie paths cannot contain any of the following ‘,; \t\r\n\013\014’ in /home/worcest/staging.worcestervt.org/wp-includes/pluggable.php on line 1161

    Can anyone provide any guidance on this error? I would really appreciate it. I have spent hours trying to find a solution.

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    There are a number of ways your cookie path could have illegal characters. Something could be wrong with your site’s home URL setting. Try carefully re-typing the setting’s value. Do not copy/paste it, actually type it in. Be sure to not include any trailing slash, but do include the “https://”. Without backend access, you must do this using the phpMYAdmin app, usually accessed through your hosting account. Navigate to your WP DB and open the options table for browsing. Find the “home” setting and edit it there. Do not change anything else.

    You may have code defining an alternative value for the COOKIEPATH constant. On most sites it’s simply “/” (without the quotes) or the subdirectory path to the WP installation. There could be code setting it to some other value. The usual place for such code is in wp-config.php. Look for any code that defines COOKIEPATH. Such code will override the WP default. The file’s content’s can be examined via your hosting file manager, or you could download it to your local computer via FTP.

    There could be a plugin or your theme altering the default value. This can be done by filtering the “home” option when it’s retrieved from the DB. As a test, try deactivating all plugins and switching to a default Twenty* theme. To deactivate plugins without backend access, rename the /plugins/ directory name via FTP or your hosting file manager. Also rename your current theme’s directory under /themes/. This will force WP to use a different theme. If any plugin or your theme is the cause, you should be able to now access the backend without error.

    If you regain access, restore the proper directory names. Activate the desired theme and plugins, one at a time, until the error returns. The last activated module will be the cause.

    Thread Starter eahrenee

    (@eahrenee)

    Thank you for the information.

    Interesting enough, my database does not have a “hone” entry. I am looking in _options, and do see the option siteurl. I also searched for home, with no results.
    I did retype the siteurl just in case.

    The wp-config file does not contain any mention of COOKIEPATH

    I renamed the plugins and themes folder. I received the same error when attempting to go to the /wp-admin login page.

    Seems the issue may be due to the home option being missing –
    I added this to the wp-config file and everything is working now.

    define( 'WP_HOME', 'http://mysite' );

    Thanks!!!

    Moderator bcworkz

    (@bcworkz)

    Defining WP_HOME is a reasonable solution. Very strange that the entry has gone missing.

    FWIW, COOKIEPATH is defined using the home option value in /wp-includes/default-constants.php. Any code that defines this before default-constants.php executes will take precedence.

    If you’re at all interested in regaining normal functionality instead of relying upon wp-config.php code, you could manually enter the option yourself via phpMyAdmin. The ID value doesn’t matter much as long as it’s not already in use. Use the table’s current AUTO_INCREMENT value as the ID, then increase AUTO_INCREMENT accordingly. The field’s autoload value should be on or yes. You should then be able comment out your wp-config.php code and still access the back end.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘I can’t access wp-admin… setcookie(): “path” option cannot contain’ is closed to new replies.