Search code examples
phpxampprestler

Restler 3 - Setup configuration


I'm using XAMPP that has PHP 5.3.1, with restler structure in htdocs folder

In my htdocs folder, I have the index.php

<?php
require_once 'vendor/restler.php';
use Luracast\Restler\Restler;

$r = new Restler();
$r->addAPIClass('Say'); // repeat for more
$r->handle(); //serve the response

and say.php

<?php
class Say {

    /*
    * @url GET /
    */
    function hello($to='world') {
        return "Hello $to!";
    }

    function hi($to) {
        return  "Hi $to!";
    }
}

In the browser, I put

localhost/index.php/Say

or

localhost/index.php/Say/hello

it gives me the following message

Fatal error: Call to undefined function Luracast\Restler\stream_resolve_include_path() in /Applications/XAMPP/xamppfiles/htdocs/Luracast/Restler/AutoLoader.php on line 143

What am I doing wrong?


Solution

  • The problem was with the PHP version. Changed from XAMPP to AMPSS that supports PHP 5.4 and its working now