[SOLVED] Error 11 or 139 (139-128 = 11) when running executable from PHP

Issues related to applications and software problems
Post Reply
jack616
Posts: 8
Joined: 2011/09/14 14:06:08

[SOLVED] Error 11 or 139 (139-128 = 11) when running executable from PHP

Post by jack616 » 2011/09/19 12:24:26

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

jack616
Posts: 8
Joined: 2011/09/14 14:06:08

Re: Error 11 or 139 (139-128 = 11) when running executable from PHP

Post by jack616 » 2011/09/19 13:11:32

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

User avatar
TrevorH
Site Admin
Posts: 33224
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Error 11 or 139 (139-128 = 11) when running executable from PHP

Post by TrevorH » 2011/09/19 13:32:43

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]

jack616
Posts: 8
Joined: 2011/09/14 14:06:08

Re: Error 11 or 139 (139-128 = 11) when running executable from PHP

Post by jack616 » 2011/09/19 15:22:29

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

User avatar
TrevorH
Site Admin
Posts: 33224
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Error 11 or 139 (139-128 = 11) when running executable from PHP

Post by TrevorH » 2011/09/19 15:28:47

Nope! Can you share what is 'myprog'?

jack616
Posts: 8
Joined: 2011/09/14 14:06:08

Re: Error 11 or 139 (139-128 = 11) when running executable from PHP

Post by jack616 » 2011/09/19 16:06:37

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

pschaff
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

Post by pschaff » 2011/09/23 21:42:14

The error represents an attempt to illegally access memory. Have you recompiled on CentOS-6?

jack616
Posts: 8
Joined: 2011/09/14 14:06:08

[SOLVED] Re: Error 11 or 139 (139-128 = 11) when running executable from PHP

Post by jack616 » 2011/09/27 10:34:28

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

pschaff
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

Post by pschaff » 2011/09/27 13:41:48

Thanks for reporting back. Marking this thread [SOLVED] for posterity.

Post Reply