ron tornambe ron tornambe - 5 months ago 29x
HTML Question

Why isn't the absolute path resolving correctly?

I am trying to implement Google's new(er) recaptcha example. I am not an expert in Linux paths.

Directory Structure

enter image description here



// autoload.php @generated by Composer

require_once '/vendor/composer/autoload_real.php';

return ComposerAutoloaderInit31f23b3d4150735cb5565ea0a0e8bdfe::getLoader();


example-captcha.php file


require_once 'autoload.php';

$siteKey === 'my-sitekey';
$secret = 'my-secret';

$lang = 'en';
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>reCAPTCHA Example</title>
<link rel="shortcut icon" href="//" type="image/x-icon"/>
<style type="text/css">
body {
margin: 1em 5em 0 5em;
font-family: sans-serif;
fieldset {
display: inline;
padding: 1em;
<h1>reCAPTCHA Example</h1>
<?php if ($siteKey === '' || $secret === ''): ?>
<h2>Add your keys</h2>
<p>If you do not have keys already then visit <tt>
<a href = ""></a></tt> to generate them.
Edit this file and set the respective keys in <tt>$siteKey</tt> and
<tt>$secret</tt>. Reload the page after this.</p>
elseif (isset($_POST['g-recaptcha-response'])):
// The POST data here is unfiltered because this is an example.
// In production, *always* sanitise and validate your input'
<h2><tt>POST</tt> data</h2>
<tt><pre><?php var_export($_POST); ?></pre></tt>

$recaptcha = new \ReCaptcha\ReCaptcha($secret);

$resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);

if ($resp->isSuccess()):
// If the response is a success, that's it!
<p>That's it. Everything is working. Go integrate this into your real project.</p>
<p><a href="/">Try again</a></p>
// If it's not successfull, then one or more error codes will be returned.
<h2>Something went wrong</h2>
<p>The following error was returned: <?php
foreach ($resp->getErrorCodes() as $code) {
echo '<tt>' , $code , '</tt> ';
<p>Check the error code reference at <tt><a href=""></a></tt>.
<p><strong>Note:</strong> Error code <tt>missing-input-response</tt> may mean the user just didn't complete the reCAPTCHA.</p>
<p><a href="/">Try again</a></p>
// Add the g-recaptcha tag to the form you want to include the reCAPTCHA element
<p>Complete the reCAPTCHA then submit the form.</p>
<form action="/" method="post">
<legend>An example form</legend>
<p>Example input A: <input type="text" name="ex-a" value="foo"></p>
<p>Example input B: <input type="text" name="ex-b" value="bar"></p>

<div class="g-recaptcha" data-sitekey="<?php echo $siteKey; ?>"></div>
<script type="text/javascript"
src="<?php echo $lang; ?>">
<p><input type="submit" value="Submit" /></p>
<?php endif; ?>


I don't understand what this reference means:

[05-May-2016 18:00:55 UTC] PHP Warning:
require_once(/vendor/composer/autoload_real.php): failed to open
stream: No such file or directory in
on line 5 [05-May-2016 18:00:55 UTC] PHP Fatal error: require_once():
Failed opening required '/vendor/composer/autoload_real.php'
on line 5


the autoload.php file is wrong. change it to:


// autoload.php @generated by Composer

require_once  '/home/deje/public_html/writers-tryst/vendor/composer/autoload_real.php';

return ComposerAutoloaderInit31f23b3d4150735cb5565ea0a0e8bdfe::getLoader();