Home Wordpress functionality plugin how to require file elsewhere on server?
Reply: 1

Wordpress functionality plugin how to require file elsewhere on server?

41358
1#
41358 Published in 2018-02-14 03:38:19Z

I need to require_once() a file in my Wordpress functionality plugin which resides at home/me/vendor/ on the server. Wordpress of course is in www/html.

Can someone direct me on how to define the path to the required file? Nothing I try seems to work.

<?php
echo "file runs";
// This file is generated by Composer
require_once 'vendor/autoload.php';
echo “file runs”;
$client   = new QuickEmailVerification\Client('api key');
$quickemailverification  = $client->quickemailverification();

try {
$response = $quickemailverification->verify("don2@inklines.art");
}
catch (Exception $e) {
echo "Code: " . $e->getCode() . " Message: " . $e->getMessage();
}

echo "<pre>"; 
print_r($response); 
echo "/<pre>"; 

?>

The first echo displays as expected (just a test). The second one does not so, for starters, I think the file can’t locate the required() file.

I just need direction on getting the file found. Any help is appreciated.

Andrew Mooney
2#
Andrew Mooney Reply to 2018-02-14 04:12:41Z

You probably need to use the absolute path for the vendor directory. Which would be /home/me/vendor. You should also ensure that Wordpress has permissions to access the directory.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.370302 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO