ajaxboy / cjax

Lightweight Ajax Framework built in PHP with no foot-print. Allows you to build ajax functionality with a single line of code & do so much more, right from the back-end!
http://cjax.sourceforge.net/
66 stars 27 forks source link

Installing cjax-5.9-RC #32

Closed oniwo closed 8 years ago

oniwo commented 8 years ago

I am unable to install cjax-5.9-RC to work with CodeIgniter 3.x. When I point to "http://127.0.0.1:8080/website/ajax.php?test/test" I get the error message:

"Cannot find the correct path to Js directory."

What should I do?

ajaxboy commented 8 years ago

can you list your root (public) directory structure?

oniwo commented 8 years ago

I dont know exactly what you mean, but let me try to explain: I extracted both CI 3.x and cjax-5.9-RC files into a folder called 'website'. This folder lies in (is a sub-directory of) 'htdocs' which is the root directory of Apache web server which I am using. I then pointed the browser to: http://127.0.0.1:8080/website/ajax.php?test/test I have also noted that as soon as I do this test, the directory cjax is automatically deleted! I have tested multiple times.

ajaxboy commented 8 years ago

I see. I know what the problem is, and there is more than one way to address this problem. I would like to try the way that can get me more information as of why this happened, if you don't mind. Can you tell me what ajax.php looks like (code)?

oniwo commented 8 years ago

You mean the content of the file, ajax.php? Here it is. ajax.php.pdf

ajaxboy commented 8 years ago

I see. I would love to be able to test on your setup, so that I can resolve this issue for others that maybe have the same configuration you have.

The issue is that , cjax cannot fine the core directory from URL, it finds it fine in the file system, but locating it in the URL can be tricky some times.

I will give you an example, this is what the path looks like when using the demos on the cjax site: ../../application/libraries/cjax/core/js/cjax.min.js

Cjax is trying to determine the path of the js file. It appears for some reason it can't determined.

Please follow the instructions in this manual to fix the issue: http://cjax.sourceforge.net/examples/docs/Iniciating_the_JavaScript_Engine.php

ajaxboy commented 8 years ago

PS: You will want to follow the last option, the one where you edit your config file, the others wont work for you.

ajaxboy commented 8 years ago

Please let me know if this has worked for you, and if it would be possible to debug the original problem further.

oniwo commented 8 years ago

Sorry I will take you back a little. I have retested the installation patiently and this is what I have realised.

  1. as soon as I point the browser to http://127.0.0.1:8080/website/ajax.php?test/test, I get the error message "Cannot find the correct path to Js directory."
    1. After this, I give the browser some time (to clear it cache). when I point to http://127.0.0.1:8080/website/ajax.php?test/test, I now get a blank page. But when I press F12 (Firefox), I see the console message "http://127.0.0.1:8080/website/application/libraries/cjax/core/js/cjax.min.js [HTTP/1.1 403 Forbidden 1ms]"
    2. I edit the the following line in the .htacces file in the /website/application/libraries/cjax/core/js/ directory as follows

--- original ---

RewriteRule ^/?(cjax._js)$ $1 [NC,QSA,L]

--- after editing --- RewriteRule ^/?(cjax._js)$ $1 [NC,QSA,L]

  1. No matter how many times I try now, the console remains with the message "http://127.0.0.1:8080/website/application/libraries/cjax/core/js/cjax.min.js [HTTP/1.1 403 Forbidden 1ms]"
ajaxboy commented 8 years ago

Try, adding "Options +Indexes" on top of the htaccess file, the rewrite rule is irrelevant to this problem

oniwo commented 8 years ago

I added "Options +Indexes" as the first non-comment line in .htaccess file The console message does not change

ajaxboy commented 8 years ago

are you able to use https://www.join.me ?

ajaxboy commented 8 years ago

ps: no quotes in the Options +Indexes can you also check the file's permission is 755? I haven't had issues with permissions ever but since this install involved moving files, it might be different.

oniwo commented 8 years ago

Oh yes, I had not include quotes.

I have just restarted the computer for a non-related issue. Then when I test I now see a pictures with the words "Put your shades on, and get ready to run this test: Run Test"

and the console has no message!

I click the "Run Test" link and I now get a blank screen with the console again screaming with the same message as before: "http://127.0.0.1:8080/website/application/libraries/cjax/core/js/cjax.min.js [HTTP/1.1 403 Forbidden 1ms]"

Therefore it seems that after something (I don't know what), http://127.0.0.1:8080/examsystem/ajax.php?test/test is now OK but http://127.0.0.1:8080/examsystem/ajax.php?test/test2 has the same problem that http://127.0.0.1:8080/examsystem/ajax.php?test/test

had before.

The "Options +Indexes" has no effect at all it seems. I have removed and I don't see any change.

ajaxboy commented 8 years ago

I have released Cjax v 5.9 RC 3, Please download and try that one, which does not move the Cjax directory. https://github.com/ajaxboy/cjax/archive/5.9rc3.zip

oniwo commented 8 years ago

I am running on PHP Version 5.5.30. phpinfo.pdf I am just about to test the 5.9rc3, will let you know as soon as I finish.

oniwo commented 8 years ago

Just tested here is the sequence of apparent events

  1. blank page, console: http://127.0.0.1:8080/website/ajax.php - [HTTP/1.0 404 Not Found 7ms]
  2. I persist with page refresh/reload and get the screen screenshot from 2016-08-19 15-47-09 , console: no element found - mod_pagespeed_beacon:1:1
  3. I click "Run Test" and get the screen screenshot from 2016-08-19 15-49-43
  4. I click "Continue" and get the screen screenshot from 2016-08-19 15-53-18
ajaxboy commented 8 years ago

To get rid of the error, open ajax.php just remove 'AJAX_VIEW' from line 44. Then re-run the test. Report back.

ajaxboy commented 8 years ago

https://github.com/ajaxboy/cjax/archive/5.9rc3b.zip already removes AJAX_VIEW, you should be able to just install this one and run the test, without making changes.

oniwo commented 8 years ago

Just tested, without line 44. here is the sequence

  1. blank page, no console: blank ~ repeated reload/refresh
  2. blank page, console: http://127.0.0.1:8080/website/ajax.php - [HTTP/1.0 404 Not Found 7ms] ~ one refresh
  3. blank page, no console: blank ~ repeated reload/refresh
  4. blank page, console: http://127.0.0.1:8080/website/ajax.php - [HTTP/1.0 404 Not Found 7ms] ~ one refresh
  5. blank page, no console: blank ~ repeated reload/refresh
  6. I get the screen screenshot from 2016-08-19 16-34-10 console: console: no element found - mod_pagespeed_beacon:1:1 ~ one refresh
  7. I get the screen screenshot from 2016-08-19 16-34-30

So it installs, but it still seem to have issues. The console is still spewing a few messages.

ajaxboy commented 8 years ago

It appears to be working, what you may have encountered an issue with is the new spin plugin, which is being used on the test page: http://cjax.sourceforge.net/examples/spin.php

Try the other demos and see, if it works or you continue getting these messages.

oniwo commented 8 years ago

Will test cjax-5.9rc3b and report back. Thanks so much for the hard work.

oniwo commented 8 years ago

I installed it well. The console messages are there but I can live with those.