Skip to content
This repository

Keep getting "No input file specified" #36

Closed
mariusbratu opened this Issue March 25, 2012 · 7 comments

3 participants

mariusbratu Luracast Richard Pijnenburg
mariusbratu

Hi there,

After a lot of searches i stumbled upon this great rest server and figure it out in minutes that this is exactly what i needed for my project.

Only problem is i can't make it work as expected. I have uploaded it on a server on goddaddy and when i try to access something like http://citytravelr.com/client_api/index.php/user or http://citytravelr.com/client_api/index.php/user/inserUser i get a 404 Not Found and in browser it says No input file specified.

Also when i try to access http://citytravelr.com/client_api/index.php i get a 404 Not Found, and in browser says Firefox can't find the file at http://citytravelr.com/client_api/index.php.

Then i said that maybe its better to try with one of your samples out of the box, but i get same behavior. You can see it here http://citytravelr.com/_005_protected_api/index.php/restricted?key=rEsTlEr2

I think it has something to do with the .htaccess file, but i cant figure it out by myself whats wrong there. Or maybe some problem in server configuration, not sure.

Please help me to figure it out this problem.

Kind Regards,
Marius Bratu.

mariusbratu

I made things a little more simpler. On first example i had other stuff loaded into User class.
Now you should call http://citytravelr.com/client_api/index.php/user/hello and you will get "No input file specified."

Have tested this on my localhost and there things are running just fine. So i am pretty sure its something wrong with server configuration but i just dont know what.

Here are the files im using:

index.php

<?
require_once 'restler/restler.php';
require_once 'user.php';

#set autoloader
#do not use spl_autoload_register with out parameter
#it will disable the autoloading of formats
spl_autoload_register('spl_autoload');

$r = new Restler();

$r->addAPIClass('User');
$r->handle();

user.php

<?php
class User {
        function hello($to='world') {
              return "Hello $to!";
        }       
}

.htaccess

DirectoryIndex index.php
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^$ index.php [QSA,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<ifModule mod_php5.c>
    php_flag display_errors Off
</IfModule>
Richard Pijnenburg

Hi @mariusbratu, welcome :-)

I've done some googling on your issue and it seems to be a server configuration issue.
Im not completely sure yet what it exactly is but seems to be related to php running in cgi mode.

Perhaps you can ask the administrator of the server to check the logs :-)

Cheers.

Luracast
Owner

@mariusbratu thanks for the complements :)

Regarding your issue "No input file specified." means that PHP engine is executed but it could not find which php script to execute

This is usually happens only on Nginx. But I know you are running Apache

I noticed that

Which could be the root cause of this problem. I suggest you host api in a subdomain or a subfolder that is not pointing to launch rock

HTH

Luracast Luracast closed this March 25, 2012
mariusbratu

Hi there,

Really thanks for your fast answer and for the hint. Indeed that was the problem, and let me post the fix here for anyone else going into this trouble in the future.

This applies for a GoDaddy account, not sure if it works same for other hostings. You will need to create a php5.ini file in your root directory and add this line to it cgi.fix_pathinfo = 1. If the file it's already created you simply add that to it.
Note that you may need to wait some time till the new php5.ini file its being loaded.

Thanks,
Marius Bratu

Luracast
Owner

@mariusbratu glad to help :)

Thanks for contributing back to restler community, this is the sprit that keeps us growing!

We are currently working on Restler 3 and discussing about the features in #22 do take part and help us to make Restler even better!

mariusbratu

@Luracast Once i get more used to Restler and based on my own needs i will be more than happy to make some suggestions:)

Luracast
Owner

Here is another suggestion from a restler user for improving .htaccess in case it does not work for you. I'm pasting it here as it may help some one

Hi,
First thanks for an wonderful tool you've developed. I had issue with the .htaccess file that it was not redirecting properly. After googling i found a small change to the .htaccess file and now it is working correctly.

RewriteEngine On 
RewriteBase / RewriteRule ^$ index.php [QSA,L] 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php [L,QSA] 

instead of %{REQUEST_FILENAME) it was suggested to prefix it with %{DOCUMENT_ROOT}
and it is working fine now. Can this be suggested to other users who have the same issue?

Thanks and Regards,
Aravidnan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.