Frapi API throws 500 error for correct action url, otherwise throws ERROR_INVALID_ACTION_REQUEST

StackOverflow https://stackoverflow.com/questions/17334615

Вопрос

I've been trying to configure the FRAPI framework for the last three day on AWS. I have configured the admin panel without errors, but, for some reason, the API portion isn't work. I can, however, access the API homepage, which is pulling actions created in the admin panel. (See http://www.serverstars.net/)

Here's the odd thing: If I enter a non-existent action url, I get the FRAPI "ERROR_INVALID_ACTION_REQUEST" error. However, if I enter a real action url, I get a 500 error. (See http://www.serverstars.net/get/banned/36.json)

The Api virtual host config:

<VirtualHost *:80>
    ServerName serverstars.net
    ServerAlias www.serverstars.net
    ServerAdmin admin@api.frapi
    DocumentRoot /var/www/frapi/src/frapi/public

    <Directory /var/www/frapi/src/frapi/public>
        AllowOverride All
        Order deny,allow
        Allow from All
    </Directory>
</VirtualHost>

The .htaccess rewrite for /var/www/frapi/src/frapi/public

RewriteEngine On
RewriteRule ^.*$ index.php [QSA,NC,L]

I suspect that the RewriteRule is causing the problem, or maybe the MySQL conn, but I doubt the SQL connection would throw a 500 error.

Your help is greatly appreciated!!

Это было полезно?

Решение

By looking at other parts of your API, mainly the default API calls that are set, we can see that the rewrite-rules are working fine.

http://www.serverstars.net/collection/foo.json

The problem is likely to reside in the model that is either selecting data from the mysql-query and puts it into the $this->data variable, or the problem resides between PHP and MySQL.

Whilst I can't give you a direct answer, I would suggest you look at the following:

  1. Make sure all the permissions are set properly by looking at: http://frapi.github.io/installing/index.html#frapi.installing.configuring.apache
  2. Print the results from the mysql query directly after having received it and use die() (yes, try print-and-die debugging),
  3. In your banned collection controller, try removing the MySQL query and put a mock variable to be returned. This will confirm whether or not the rewrite rules reach your controller,
  4. If the mock variable is returned properly after removing the SQL Query and its results, look at debugging the values returned by the SQL query and how you select relevant data from it.
  5. If all fails, make sure you have logs on the apache side, and also look at the PHP error log. If you don't have php-error-logs enabled, add this to your php.ini:

    error_log = /tmp/php_error_log

Now, this doesn't directly answer your question but hopefully it'll help you reach the answer you are looking for :-)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top