STACK and php 5.3

STACK and php 5.3

by Malik Koné -
Number of replies: 17

Hi,

I have installed maxima and gnuplot on a shared host. They work fine on the command line. 

But using Moodle and STACK health check I get an error and the message "CAS failed to return any evaluated expressions. Please check your connection with the CAS.".

 

From what I've read on this forum this could be a problem with my php version 5.3.26 but I cannot change it.  So do you have another solution.

 

Thanks

Average of ratings: -
In reply to Malik Koné

Re: STACK and php 5.3

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Well, PHP 5.3 is pretty much at the end of support (see, for example http://php.net/archive/2012.php#id2012-12-20-1). So, you will have to change it eventually.

Do you have the specific link to the forum post that explains why PHP 5.3.x can't work. Right now I can't think of what we might have done in the code to cause that to be the case.

In reply to Tim Hunt

Re: STACK and php 5.3

by Malik Koné -

Here is the thread I'm talking about.  4th from the bottom Miguel Frade says that upgrading from php 5.3.10 to 5.4.17 solved his problem with proc_open().

As for me, I turned on CAS, debugging, and ran the CAS command directly on maxima command prompt.  It seems OK to me.  But expert advice is welcome.

(%i1) load(".../moodledata/stack/maximalocal.mac");
Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $
WARNING: DEFUN/DEFMACRO: redefining function TEX-MQUOTIENT in .../edukone/question/type/stack/stack/maxima/stacktex.lisp, was
         defined in /.../tmp/maxima-5.31.3/src/binary-clisp/mactex.fas
WARNING: DEFUN/DEFMACRO: redefining function TEX-MATRIX in .../edukone/question/type/stack/stack/maxima/stacktex.lisp, was defined
         in /.../tmp/maxima-5.31.3/src/binary-clisp/mactex.fas
WARNING: DEFUN/DEFMACRO: redefining function TEX-PREFIX in .../edukone/question/type/stack/stack/maxima/stacktex.lisp, was defined
         in /.../tmp/maxima-5.31.3/src/binary-clisp/mactex.fas
WARNING: DEFUN/DEFMACRO: redefining function TEX-STRING in .../edukone/question/type/stack/stack/maxima/stacktex.lisp, was defined
         in /.../tmp/maxima-5.31.3/src/binary-clisp/mactex.fas
WARNING: DEFUN/DEFMACRO: redefining function TEX-DERIVATIVE in .../edukone/question/type/stack/stack/maxima/stacktex.lisp, was
         defined in /.../tmp/maxima-5.31.3/src/binary-clisp/mactex.fas
WARNING: DEFUN/DEFMACRO: redefining function TEX-D in .../edukone/question/type/stack/stack/maxima/stacktex.lisp, was defined in
         /.../tmp/maxima-5.31.3/src/binary-clisp/mactex.fas
WARNING: (SETF FIND-CLASS): redefining class MRING in /.../usr/local/share/maxima/5.31.3/share/linearalgebra/mring.lisp, was defined in
         /.../tmp/maxima-5.31.3/src/binary-clisp/numth.fas
0 errors, 1 warning
[ STACK-Maxima started, library version 2013060300 ]
(%o0) ".../moodledata/stack/maximalocal.mac"
(%i1) cab:block([ RANDOM_SEED, OPT_NoFloats, sqrtdispflag, simp, assume_pos, caschat0, caschat1], stack_randseed(0), make_multsgn("dot"), make_complexJ("i"), make_arccos("cos-1"), OPT_NoFloats:true, sqrtdispflag:true, simp:true, assume_pos:false, print("[TimeStamp= [ 0 ], Locals= [ ") , print("-1=[ error= ["), cte("__stackmaximaversion",errcatch(__stackmaximaversion:stackmaximaversion)) , print("0=[ error= ["), cte("caschat0",errcatch(caschat0:plot([x^4/(1+x^4),diff(x^4/(1+x^4),x)],[x,-3,3]))) , print("1=[ error= ["), cte("caschat1",errcatch(caschat1:plot([sin(x),x,x^2,x^3],[x,-3,3],[y,-3,3]))) , print("] ]") , return(true) );
[TimeStamp= [ 0 ], Locals= [
-1=[ error= [
], key= [
__stackmaximaversion
]
, value= [
2013060300
], display= [
2013060300
]
],
0=[ error= [
], key= [
caschat0
]
, value= [
" <html><div class=\"stack_plot\"><img src='!ploturl!stackplot-3596556655-57136044.png' alt='STACK auto-generated plot of [x^4/(x^4+1),4*x^3/(x^4+1)-4*x^7/(x^4+1)^2] with parameters x,-3,3' /></div></html> "

], display= [

 \mbox{ <html><div class="stack\_plot"><img src='!ploturl!stackplot-3596556655-57136044.png' alt='STACK auto-generated plot of [x^4/(x^4+1),4*x^3/(x^4+1)-4*x^7/(x^4+1)^2] with parameters x,-3,3' /></div></html> }

]
],
1=[ error= [
plot2d: some values were clipped.
plot2d: some values were clipped.
], key= [
caschat1
]
, value= [
" <html><div class=\"stack_plot\"><img src='!ploturl!stackplot-3596556659-46248239.png' alt='STACK auto-generated plot of [sin(x),x,x^2,x^3] with parameters x,-3,3],[y,-3,3' /></div></html> "

], display= [

 \mbox{ <html><div class="stack\_plot"><img src='!ploturl!stackplot-3596556659-46248239.png' alt='STACK auto-generated plot of [sin(x),x,x^2,x^3] with parameters x,-3,3],[y,-3,3' /></div></html> }

]
],
] ]
(%o1) true
(%i2)

I reviewing the clips installation as sometimes I get lisp errors.

In reply to Malik Koné

Re: STACK and php 5.3

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Can you turn on Debugging in Moodle (to DEVELOPER level) and try again. What does CAS debugging say about how that output is parsed? Can you try the relevant Maxima input in the CAS chat script?

Basically, I am still puzzled, and fishing for clues.

In reply to Tim Hunt

Re: STACK and php 5.3

by Malik Koné -

Hi Tim,

I'm not an expert in CAS.  so I tried 1+1 in CAS chat... it displays 1+1 ... no error message

But If I add a question variable (I'm really not sure how to use this) so I tried with 'x' as variable and 'x+1'in CAS text, I get roughly the same error message than in the health Check, which is:

Context used

Platform: unix Maxima shell command: maxima Maxima initial command: load("/home6/nowyanet/public_html/moodledata/stack/maximalocal.mac"); Maxima timeout: 5

Maxima command

cab:block([ RANDOM_SEED, OPT_NoFloats, sqrtdispflag, simp, assume_pos, caschat0, caschat1], stack_randseed(0), make_multsgn("dot"), make_complexJ("i"), make_arccos("cos-1"), OPT_NoFloats:true, sqrtdispflag:true, simp:true, assume_pos:false, print("[TimeStamp= [ 0 ], Locals= [ ") , print("-1=[ error= ["), cte("__stackmaximaversion",errcatch(__stackmaximaversion:stackmaximaversion)) , print("0=[ error= ["), cte("caschat0",errcatch(caschat0:x^4/(1+x^4))) , print("1=[ error= ["), cte("caschat1",errcatch(caschat1:diff(x^4/(1+x^4),x))) , print("] ]") , return(true) );

Timings

Start: 1387653476.7649, End: 1387653476.7715, Taken = 0.0065159797668457

CAS result

Warning, empty result!

unpack_raw_result: completely empty result was returned by the CAS.

Unpacked result as

Array
(
)

Maxima version (I'm using maxima 5.28)

CAS failed to return any evaluated expressions. Please check your connection with the CAS.



In reply to Malik Koné

Re: STACK and php 5.3

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

If you are getting a time-out, then try just increasing the time-out in the STACK settings. I think the default is 5 seconds, which is already quite slow, so you may not really want to increase it to 10 seconds, but if that makes it work, then it is better than nothing.

And, after you have got it working reliably, then you can think about doing what it says here: https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/CAS/Optimising_Maxima.md

In reply to Tim Hunt

Re: STACK and php 5.3

by Malik Koné -
I tried with connection timeout 15 and here is what I get.a permission error. 
I'm not an expert, but I had to compile maxima from source in ~/usr/local on a shared (linux) host because I do not have rights to use dpkg or apt-get.
I wondered if Maxima is trying to access a file for which I do not have the rights...
Maxima compiled and I can use it on the command line. So I don't know.

I would like to use it to make simple algebra questions for my secondary students but also as a show case for university professors.
Here in Abidjan, (Côte d'Ivoire) that will be a "premiere".

I guess I am struggling also because of my limited resources (no private internet connection and no private server)

Thanks.


*** - UNIX error 13 (EACCES): Permission denied Break 1 [4]> *** - SYSTEM::READ-EVAL-PRINT: variable LOAD has no value The following restarts are available: USE-VALUE :R1 Input a value to be used instead of LOAD. STORE-VALUE :R2 Input a new value for LOAD. ABORT :R3 Abort debug loop Break 2 [5]> *** - READ from #<INPUT CONCATENATED-STREAM #<INPUT STRING-INPUT-STREAM> #<IO TWO-WAY-STREAM #<INPUT UNBUFFERED FILE-STREAM CHARACTER #P"/dev/fd/0" @4> #<OUTPUT UNBUFFERED FILE-STREAM CHARACTER #P"/dev/fd/1">>> : there is no package with name "CAB" The following restarts are available: ABORT :R1 Abort debug loop ABORT :R2 Abort debug loop Break 3 [6]> *** - SYSTEM::READ-EVAL-PRINT: variable QUIT has no value The following restarts are available: USE-VALUE :R1 Input a value to be used instead of QUIT. STORE-VALUE :R2 Input a new value for QUIT. ABORT :R3 Abort debug loop ABORT :R4 Abort debug loop ABORT :R5 Abort debug loop Break 4 [7]> The CAS timed out. ] ] ] ]
In reply to Malik Koné

Re: STACK and php 5.3

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Those errors are very odd. 'load' is a standard Maxima command, but somehow it is not being recognised.

I am sorry that it is not working for you.

The problem seems to be with just running Maxima from the command line. I think you need to first concentrate on getting Maxima running properly on the command line. Until you are sure that is working, there is not point trying to get the rest of STACK working.

So, try following these instructions to run Maxima from the command-line and load the library code that STACK requires: http://stack.bham.ac.uk/moodle/question/type/stack/doc/doc.php/CAS/STACK-Maxima_sandbox.md

Here are some useful Maxima commands:

  • 1+1;
  • quit();     (you really need to know this one. The hard bit to remember is that quit is a function, and it is not exit() or bye().)

I hope you can get it working.

In reply to Tim Hunt

Re: STACK and php 5.3

by Malik Koné -

Tim,

I'm sorry I got you confused with my other question. 

I have two maxima installations.

  • One on a sharedhost online (bluehost)
  • and another one on my local machine.

The one on the sharedhost is what I am most concerned about and it's what I tryed discussing up to my last message.

On the distant sharedhost the maxima installation seems ok.

The problem seems to be a right issue because CAS result in health check starts with: 

*** - UNIX error 13 (EACCES): Permission denied
Break 1 [4]> ...

On my distant installation string(x+x^2); and parse_string("x+x^2"); work fine from the ssh connection. and here is what I get when I reproduce the health command.

(%i1) load("stackmaxima.mac");
Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $
WARNING: DEFUN/DEFMACRO: redefining function TEX-MQUOTIENT in /home6/nowyanet/public_html/edukone/question/type/stack/stack/maxima/stacktex.lisp, was
defined in /home6/nowyanet/tmp/maxima-5.31.3/src/binary-clisp/mactex.fas
WARNING: DEFUN/DEFMACRO: redefining function TEX-MATRIX in /home6/nowyanet/public_html/edukone/question/type/stack/stack/maxima/stacktex.lisp, was defined
in /home6/nowyanet/tmp/maxima-5.31.3/src/binary-clisp/mactex.fas
WARNING: DEFUN/DEFMACRO: redefining function TEX-PREFIX in /home6/nowyanet/public_html/edukone/question/type/stack/stack/maxima/stacktex.lisp, was defined
in /home6/nowyanet/tmp/maxima-5.31.3/src/binary-clisp/mactex.fas
WARNING: DEFUN/DEFMACRO: redefining function TEX-STRING in /home6/nowyanet/public_html/edukone/question/type/stack/stack/maxima/stacktex.lisp, was defined
in /home6/nowyanet/tmp/maxima-5.31.3/src/binary-clisp/mactex.fas
WARNING: DEFUN/DEFMACRO: redefining function TEX-DERIVATIVE in /home6/nowyanet/public_html/edukone/question/type/stack/stack/maxima/stacktex.lisp, was
defined in /home6/nowyanet/tmp/maxima-5.31.3/src/binary-clisp/mactex.fas
WARNING: DEFUN/DEFMACRO: redefining function TEX-D in /home6/nowyanet/public_html/edukone/question/type/stack/stack/maxima/stacktex.lisp, was defined in
/home6/nowyanet/tmp/maxima-5.31.3/src/binary-clisp/mactex.fas
WARNING: (SETF FIND-CLASS): redefining class MRING in /home6/nowyanet/usr/local/share/maxima/5.31.3/share/linearalgebra/mring.lisp, was defined in
/home6/nowyanet/tmp/maxima-5.31.3/src/binary-clisp/numth.fas
0 errors, 1 warning
[ STACK-Maxima started, library version 2013060300 ]
(%o0) "stackmaxima.mac"
(%i1) cab:block([ RANDOM_SEED, OPT_NoFloats, sqrtdispflag, simp, assume_pos, caschat0, caschat1], stack_randseed(0), make_multsgn("dot"), make_complexJ("i"), make_arccos("cos-1"), OPT_NoFloats:true, sqrtdispflag:true, simp:true, assume_pos:false, print("[TimeStamp= [ 0 ], Locals= [ ") , print("-1=[ error= ["), cte("__stackmaximaversion",errcatch(__stackmaximaversion:stackmaximaversion)) , print("0=[ error= ["), cte("caschat0",errcatch(caschat0:x^4/(1+x^4))) , print("1=[ error= ["), cte("caschat1",errcatch(caschat1:diff(x^4/(1+x^4),x))) , print("] ]") , return(true) );
[TimeStamp= [ 0 ], Locals= [
-1=[ error= [
], key= [
__stackmaximaversion
]
, value= [
2013060300
], display= [
2013060300
]
],
0=[ error= [
], key= [
caschat0
]
, value= [
x^4/(x^4+1)
], display= [
\frac{x^4}{x^4+1}
]
],
1=[ error= [
], key= [
caschat1
]
, value= [
4*x^3/(x^4+1)-4*x^7/(x^4+1)^2
], display= [
\frac{4\cdot x^3}{x^4+1}-\frac{4\cdot x^7}{\left(x^4+1\right)^2}
]
],
] ]
(%o1) true

Good right ?

If so, what's that UNIX error 13 (EACCES) : Permission denied

ps: I found a good tutorial about maxima and I think I have the basics now. I will not try quit, help, q(), Ctrl X, ?, :q, exit, exit() before getting it right quit();
In reply to Malik Koné

Re: STACK and php 5.3

by Malik Koné -

I have another problem on my local machine. php 5.4

I cannot load stackmaxima.mac file I get an error with the following detail.

file_search1: eval_string not found in file_search_maxima,file_search_lisp.
 -- an error.  Entering the Maxima debugger.
stack_reset(rand_seed=1000)(stackmaxima.mac line 33)
.../question/type/stack/stack/maxima/stackmaxima.mac:33::
That is here
  MAXIMA_VERSION:map(parse_string, tokens(?\*autoconf\-version\*, 'digitcharp)),


 How can I debug this?

In reply to Malik Koné

Re: STACK and php 5.3

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Malik,

Sorry to come to this discussion late, but I'll try to help.  I suspect you may have an incomplete installation of Maxima.  Could you load up Maxima on the command line and try

string(x+x^2);

and then try

parse_string("x+x^2");

 

You're welcome to contact me offline to help resolve this.

Chris

 

In reply to Christopher Sangwin

Re: STACK and php 5.3

by Malik Koné -

Ok, I need to go home, try this on my local machine, and come back.

I happy to see help coming.

Thank you.

In reply to Malik Koné

Re: STACK and php 5.3

by Malik Koné -
The above did not pose a problem. But I have on my local and on the host installation ran some test from the test folder in maxima. #24 and #25 from rtest10.mac fail.. Some other fail in rtest12.mac Here's an example: ********************** Problem 24 *************** Input: 1/5 1/4 1/3 (expr : 4 + 3 + 2 , cf(expr), foop(%%, cf(rat(bfloat(expr))))) Result: false This differed from the expected result: true ********************** Problem 25 *************** Input: 7/5 2/3 (expr : - 11 + sqrt(17) + 2 + sqrt(2), cf(expr), foop(%%, cf(rat(bfloat(expr))))) Result: false This differed from the expected result: true
In reply to Christopher Sangwin

Re: STACK and php 5.3

by Malik Koné -

string(x+x^2);
ok x^2+x
parse_string("x+x^2");
not ok
file_search1:eval_string not found in file_search_maxima, file_search_lisp...

 

Does this have to do with the maxima-init.mac?


I don't know what to write instead of ### in the following lines to be inserted in maxima-init.mac ?

file_search_maxima:append([sconcat(".../maxima/###.{mac,mc}")],file_search_maxima)$
file_search_lisp:append([sconcat(".../maxima/###.{lisp}")],file_search_lisp)$

 

Thanks, and Happy new year ;)

In reply to Malik Koné

Re: STACK and php 5.3

by Christopher Sangwin -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Malik,

This means you have an incomplete installation of Maxima on your server - it isn't really anything to do with the STACK code itself!  

Chris

In reply to Christopher Sangwin

Re: STACK and php 5.3

by Malik Koné -

Ok, that's clear for my local installation. I'm planing a reinstall of maxima, gcl or clisp in the following days there.

But my distant host installation pass the test you gave me.

So I think my problem might be either a right issue, or a installation issue because after some times, maxima through a lisp error. How can I be sure that lisp and/or maxima are correctly installed?

 

thanks

In reply to Malik Koné

Re: STACK and php 5.3

by Malik Koné -

Yes Yes Yes

eureka

I have maxima working.

I removed everything

and started again with gcl this time

 

I compiled from source with --enable-ansi

compiled maxima from source.

and it just worked.

 

OK, that been done... I have another issue with googleauth smile