Closed captainwasabi closed 10 years ago
Can you open F12 developer tools and tell me what's coming back from the calls to api/*
?
You may also want to take a look at this issue and see if it's related.
I had that eariler problem until I enabled the expires mod.
You'll have to give me more explicit instructions re:how to use the dev tools. I am not a web dev.
If I open it up and go to the Network tab, I see a repeating loop going to /api boards and /api users, all returning 200 OK, usually in 2-3ms each, and it just repeats over and over and over.
No problem. You got yourself there anyway! Click on one of those calls (the boards and users are updated as often as possible to keep things near real-time) and let me know what's coming back in the Response tab (it should be a JSON object).
Just copy/paste that here and I'll see if I can figure anything out.
looks like code, I'm suspecting I don't have the website set up properly, hmm:
<?php require_once('lib/Slim/Slim.php'); require_once('lib/rb.php'); require_once('lib/password.php'); require_once('lib/JWT.php');
require_once('jsonResponse.php');
use Slim\Slim; Slim::registerAutoloader();
$app = new Slim(); $app->response->headers->set('Content-Type', 'application/json');
$jsonResponse = new JsonResponse(); require_once('helpers.php'); // Must come after $jsonResponse exists.
R::setup('sqlite:taskboard.db'); createInitialUser();
$app->notFound(function() use ($app, $jsonResponse) { $app->response->setStatus(404); $jsonResponse->message = 'Matching API call Not found.';
$app->response->setBody($jsonResponse->asJson());
});
// TODO: Figure out updating token on activity. $app->get('/authenticate', function() use($app, $jsonResponse) { if (validateToken()) { $jsonResponse->message = 'Token is authenticated.'; // $user = getUser(); // setUserToken($user, (0.5 * 60 * 60) /* Half an hour */); // R::store($user); // $jsonResponse->data = $user->token; } $app->response->setBody($jsonResponse->asJson()); });
require_once('userRoutes.php'); require_once('boardRoutes.php'); require_once('itemRoutes.php');
$app->run(); R::close();
Yeah, that's the actual PHP file. If that's coming back, I'm thinking your site isn't setup to execute PHP.
Maybe this will help: http://stackoverflow.com/questions/5121495/php-code-is-not-being-executed-i-can-see-it-on-source-code-of-page
Closing this for now. Let me know if you still need assistance.
ok, installed php5 ;)
Now I can't log in again and get the following in the error log:
[Mon Oct 20 13:28:16 2014] [error] [client xxx.xxx.xxx.xxx] PHP Parse error: syntax error, unexpected '[' in /var/www/Taskboard/api/jsonResponse.php on line 19
That's $this->alerts[] = ['type' => $type, 'text' => $text];
and I have no idea why that's giving an error. What version of PHP did you install?
ubuntu 12.04, running apache2, with php5
I installed php5, libapache2-mod-php5, and php5-cgi, and php5-mcrypt, and php5-gd (cron was throwing some errors)
What is the output of php -v
? I'm asking because it might be that you have 5.3.x where that line of code will have issues from what I found just now.
Oh, I just set up phpinfo.php. and yes, it's PHP Version 5.3.10-1ubuntu3.14
php -v PHP 5.3.10-1ubuntu3.14 with Suhosin-Patch (cli) (built: Sep 4 2014 07:08:49) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
Maybe this will help: http://www.dev-metal.com/how-to-setup-latest-version-of-php-5-5-on-ubuntu-12-04-lts/
Not the warning at the beginning... up to you whether it's worth it.
man, sorry this is such a pain ;)
ok, no errors from php, but I get this in the F12 dev area when I try to log in:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
The requested URL /Taskboard/api/login was not found on this server.
What is the full url of your login page?
So your login page is at abc.def.com/Taskboard/#/
right? What do you get (in dev tools) when you go directly to abc.def.com/Taskboard/api/
? (EDIT: It'll just be a blank page in the browser.)
eek, I get the directory listing
Is mod_rewrite enabled?
it says it is
a2enmod rewrite Module rewrite already enabled
what does the contents of the apache site config file for your demo site look like?
<Directory /my/directory/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ah, finally back to this. Ok, added that and also figured out that when php upgraded it also upgraded apache2, and the new apache requires config files to have a .conf extension.
So now I get the following in teh error.log:
[Tue Oct 21 15:36:08.969478 2014] [:error] [pid 31687] [client 192.168.xxx.xxx:49559] PHP Fatal error: Uncaught exception 'PDOException' with message 'Could not connect to database (?).' in /var/www/html/Taskboard/api/lib/rb.php:754\nStack trace:\n#0 /var/www/html/Taskboard/api/lib/rb.php(593): RedBeanPHP\Driver\RPDO->connect()\n#1 /var/www/html/Taskboard/api/lib/rb.php(778): RedBeanPHP\Driver\RPDO->runQuery('SELECT COUNT()...', Array)\n#2 /var/www/html/Taskboard/api/lib/rb.php(801): RedBeanPHP\Driver\RPDO->GetAll('SELECT COUNT()...', Array)\n#3 /var/www/html/Taskboard/api/lib/rb.php(2998): RedBeanPHP\Driver\RPDO->GetCol('SELECT COUNT()...', Array)\n#4 /var/www/html/Taskboard/api/lib/rb.php(4407): RedBeanPHP\Adapter\DBAdapter->getCell('SELECT COUNT()...', Array)\n#5 /var/www/html/Taskboard/api/lib/rb.php(6370): RedBeanPHP\QueryWriter\AQueryWriter->queryRecordCount('user', Array, '', Array)\n#6 /var/www/html/Taskboard/api/lib/rb.php(7574): RedBeanPHP\Repository->count('user', '', Array)\n#7 /var/www/html/Taskboard/api/lib/rb.php(10133): RedBeanPHP\OODB->count('user', '', Array)\n#8 /var/www/html/Taskboard/api/helpers in /var/www/html/Taskboard/api/lib/rb.php on line 754, referer: http://aaa.bbb.com/ ....... Note: now I do get the blank page when I go to /api/.
You've made sure the api
directory is writable?
I'll come back to this tomorrow and maybe something will occur to me by then!
f: /var/www/html/Taskboard/api/ drwxr-xr-x root root / drwxr-xr-x root root var drwxr-xr-x root root www drwxr-xr-x www-data www-data html drwxr-xr-x www-data www-data Taskboard drwxr-xr-x www-data www-data api
oh, I even tried chmodding the whole tree to 777 just to see if that was the problem. No dice.
AH HA!!!! I needed to install php5-sqlite!
it seems to be all working now!
Thank you for your patience and all your help! I'll give feedback as it occurs to me.
Glad you solved it!
I'll be happy to get your feedback, thanks.
Can you please update this to PHP 7.x; I've got it running but same problem as @captainwasabi the taskboard and taskboard users don't load ?
No users, no boards, no actions, no buttons to make new ones. Only a spinner saying it's loading them.