[SOLVED] Error 11 or 139 (139-128 = 11) when running executable from PHP
[SOLVED] Error 11 or 139 (139-128 = 11) when running executable from PHP
PROBLEM
InPHP script
exec('myprog someText ', $aout, $retval); gives retval 11 or 139
Running kernal/system commands works fine eg ls grep etc are OK
HISTORY
"myprog" is an executable that has been in use with centos 4 and 5 for about 5 years with no trouble.
It essentially takes command line text - changes it and spits it back out into $aout array.
INSTALL
I have everything installed from the C6 DVD downloaded last week now.
I've tried on 2 different hardware families
The only software addition to the DVD install so far is the PHP script that calls myprog.(ie essentially clean)
I have isolated the line above into a PHP script on its own so there is no interaction with ofther PHP calls.
At first I thought it was a PHP error but it seems other Linuxes have had similar issues of late.
The problem is I googled and found 4 different explanations of what is happening and none
of them fix my issue and none mention Centos.
Has anyone seen this or help me fix it please? Its a big issue for me.
thanks
jack
InPHP script
exec('myprog someText ', $aout, $retval); gives retval 11 or 139
Running kernal/system commands works fine eg ls grep etc are OK
HISTORY
"myprog" is an executable that has been in use with centos 4 and 5 for about 5 years with no trouble.
It essentially takes command line text - changes it and spits it back out into $aout array.
INSTALL
I have everything installed from the C6 DVD downloaded last week now.
I've tried on 2 different hardware families
The only software addition to the DVD install so far is the PHP script that calls myprog.(ie essentially clean)
I have isolated the line above into a PHP script on its own so there is no interaction with ofther PHP calls.
At first I thought it was a PHP error but it seems other Linuxes have had similar issues of late.
The problem is I googled and found 4 different explanations of what is happening and none
of them fix my issue and none mention Centos.
Has anyone seen this or help me fix it please? Its a big issue for me.
thanks
jack
Re: Error 11 or 139 (139-128 = 11) when running executable from PHP
While writing the above it occured to me to try it from a terminal shell.
Calling the program from a shell causes a "Segmentation fault" every time.
This didnt used to happen (no the program isnt corrrupt - I've tried a number of copies)
again - any help appreciated
jack
Calling the program from a shell causes a "Segmentation fault" every time.
This didnt used to happen (no the program isnt corrrupt - I've tried a number of copies)
again - any help appreciated
jack
Re: Error 11 or 139 (139-128 = 11) when running executable from PHP
Try using strace (yum install strace if it isn't a known command) to trace the execution of your shell command. e.g
[code]
strace -f -o /tmp/strace.out myprog
[/code]
[code]
strace -f -o /tmp/strace.out myprog
[/code]
Re: Error 11 or 139 (139-128 = 11) when running executable from PHP
Thanks Trevor
I ran your suggestion and it gives:
4140 execve("./myprog", ["./myprog"], [/* 46 vars */]) = 0
4140 --- SIGSEGV (Segmentation fault) @ 0 (0) ---
4140 +++ killed by SIGSEGV (core dumped) +++
I dont know enough to go further - does it help ?
jack
I ran your suggestion and it gives:
4140 execve("./myprog", ["./myprog"], [/* 46 vars */]) = 0
4140 --- SIGSEGV (Segmentation fault) @ 0 (0) ---
4140 +++ killed by SIGSEGV (core dumped) +++
I dont know enough to go further - does it help ?
jack
Re: Error 11 or 139 (139-128 = 11) when running executable from PHP
Nope! Can you share what is 'myprog'?
Re: Error 11 or 139 (139-128 = 11) when running executable from PHP
Its nothing special Trevor - just a collection of text manipulation functions called via a command line interface.
Its quite big for a text program and can do a few things in sequence that would otherwise cause me problems though.
Its written in pascal if that makes a difference (I'm asking on the compiler forums if
anyone else has seen the issue but so far no response)
It could be something the compiler does but I doubt that because google returns many
complaints about this problem with things written in C or when using device drivers etc.
Still - I'll keep looking at that.
I'm starting to think something important has changed in Linux kernals but my knowledge
isn't good enough to really know. I know enough to just get by most of the time but thats about all.
jack
Its quite big for a text program and can do a few things in sequence that would otherwise cause me problems though.
Its written in pascal if that makes a difference (I'm asking on the compiler forums if
anyone else has seen the issue but so far no response)
It could be something the compiler does but I doubt that because google returns many
complaints about this problem with things written in C or when using device drivers etc.
Still - I'll keep looking at that.
I'm starting to think something important has changed in Linux kernals but my knowledge
isn't good enough to really know. I know enough to just get by most of the time but thats about all.
jack
-
- Retired Moderator
- Posts: 18276
- Joined: 2006/12/13 20:15:34
- Location: Tidewater, Virginia, North America
- Contact:
[SOLVED] Error 11 or 139 (139-128 = 11) when running execut
The error represents an attempt to illegally access memory. Have you recompiled on CentOS-6?
[SOLVED] Re: Error 11 or 139 (139-128 = 11) when running executable from PHP
Thanks Phil
Yes that was part of the problem. I was able to recompile under a newer release of the compiler. So all good there now.
It turns out I had another issue too - The FTP program I was using to upload to the server was
unable to identify a linux program as binary and was uploading (presumably) as text.
I discovered this out of sheer confused desperation.
For info the FTP program is Filezilla Version 3.4.0
This is worth noting if anyone uses this popular program as I confirmed it by repeatedly switching to and from auto detect.
Thanks to everyone who helped.
jack
Yes that was part of the problem. I was able to recompile under a newer release of the compiler. So all good there now.
It turns out I had another issue too - The FTP program I was using to upload to the server was
unable to identify a linux program as binary and was uploading (presumably) as text.
I discovered this out of sheer confused desperation.
For info the FTP program is Filezilla Version 3.4.0
This is worth noting if anyone uses this popular program as I confirmed it by repeatedly switching to and from auto detect.
Thanks to everyone who helped.
jack
-
- Retired Moderator
- Posts: 18276
- Joined: 2006/12/13 20:15:34
- Location: Tidewater, Virginia, North America
- Contact:
Re: [SOLVED] Re: Error 11 or 139 (139-128 = 11) when running executable from PHP
Thanks for reporting back. Marking this thread [SOLVED] for posterity.