• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

RESOLVED Include path not recognized

jptml

New member
Messages
2
Likes
0
Points
1
#1
I am trying to upgrade the PHP our Windows 2012 R2 server from 5.5 to 7.3.29 and have upgraded Woody Snippets to 2.4.1. Now, Woody snippet includes have stopped working. For example, I had a snippet that was simply this:
PHP:
$user = get_userdata(get_current_user_id());
include('\wp-includes\userCreated\cars3\orig-newcar-manager.php');
Now, the content section of the page that used to display a form now displays nothing. Using another plugin, I see these errors being displayed:
php-errors-cars.png

The full path on the server to this file is C:\inetpub\site.org\wp-includes\userCreated\classlib3\orig-newcar-manager.php

I've tried every combination of path I can think of in the snippet to get the file included. I've use the full path, added double-backslashes, forward slashes, double forward slashes, adding a dot before the leading slash (which creates a 500 error), and nothing works. Can anyone advise?
 

Attachments

jptml

New member
Messages
2
Likes
0
Points
1
#2
Found a solution. While the relative paths don't work any longer as far as I can tell, updating them to include the full path with double-backslashes now works, like:
PHP:
include('C:\\inetpub\\site.org\\wp-includes\\userCreated\\classlib3\\orig-newcar-manager.php');
Could've sworn I tried that previously, but maybe I made a mistake on it.
 

Temyk

Developer & Support
Messages
1,129
Likes
42
Points
48
#3
Hello.

Wordpress has a special constant ABSPATH with the path to the site folder
PHP:
include_once ABSPATH.'/wp-includes/userCreated/cars3/orig-newcar-manager.php';