fatal error on shell_cmd()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wwasher
Forum Newbie
Posts: 4
Joined: Thu Mar 03, 2011 8:01 pm

fatal error on shell_cmd()

Post by wwasher »

Newbie question here on error handling:

I have a simple shell_exec() command that sometimes exceeds 30 seconds and this causes a fatal error.
I also want the script to skip any shell_exec() command that takes longer than 30 seconds.

What I have found out so far (maybe I am wrong?):
-Try/catch will not work
-There is no way around a fatal error

I feel like I am spinning my wheels trying to figure this out on my own.
So how to I avoid the fatal error or handle it with PHP only? Is it doable?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: fatal error on shell_cmd()

Post by Christopher »

(#10850)
wwasher
Forum Newbie
Posts: 4
Joined: Thu Mar 03, 2011 8:01 pm

Re: fatal error on shell_cmd()

Post by wwasher »

thanks but that is a bit of a f**k off answer. Need more intellect/handholding.

Look I have read it can be done. I have read that it can't be done. I have been told to use try/catch

So what is the deal? Can these errors be caught and can you give more of a clue than an easy to find and already visited manual page that is going to take me a full day to go through properly.

I spent over an hour trying to figure out a solution that may not exist and really need a little hand holding.
So how about a bit of a helping hand???

thanks.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: fatal error on shell_cmd()

Post by Christopher »

wwasher wrote:thanks but that is a bit of a f**k off answer. Need more intellect/handholding.
You asked, "So how to I avoid the fatal error or handle it with PHP only? Is it doable?" I provided links to things to try besides exceptions. I have limited time. Should I avoid responding to your posts unless I have a lot of time for an detailed response?
wwasher wrote:Look I have read it can be done. I have read that it can't be done. I have been told to use try/catch

So what is the deal? Can these errors be caught and can you give more of a clue than an easy to find and already visited manual page that is going to take me a full day to go through properly.

I spent over an hour trying to figure out a solution that may not exist and really need a little hand holding.
So how about a bit of a helping hand???
So, did you try the error suppression operator or implementing an error handler? There is lots of example code in the manual and comments. You could read those manual pages is 5-10 minutes.
(#10850)
wwasher
Forum Newbie
Posts: 4
Joined: Thu Mar 03, 2011 8:01 pm

Re: fatal error on shell_cmd()

Post by wwasher »

thanks.....I was a bit insulted being sent to the manual page and not given any clue if the problem was solvable. With some exception I have read that the problem is not solvable but have not found a decent example of it.

I can appreciate that you don't have a lot of time but I did read for the 5-10 minutes and even went through those pages. If I had figured it out I would not have asked. As you know those man pages sometimes miss things, taking a full day to experiment with the error functions of PHP is not working for me right now.

Just looking for the benefit of experience. Pats on the head showing me the way to the manual are not so helpful. I can understand how some problems are easily solved this way but this is certainly not one of them.

thanks....

so what have people experienced when trying to overcome fatal errors caused by an external(r) call_exec() fatal error???????????
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: fatal error on shell_cmd()

Post by Christopher »

So what have you tried? Can your post your code trying exceptions, the error suppression operator and/or an error handler?
(#10850)
wwasher
Forum Newbie
Posts: 4
Joined: Thu Mar 03, 2011 8:01 pm

Re: fatal error on shell_cmd()

Post by wwasher »

Christopher wrote:So what have you tried? Can your post your code trying exceptions, the error suppression operator and/or an error handler?
This is a pretty simple question asked (maybe not a simple answer). If a person can't figure out from the above posts what I am looking for (barring english/other language barrier) then I do not see any benefit having that person help on this item:

-the code is "shell_exec(%someExecutable%)"
-it is throwing a fatal timeout error
-what I first need is a simple yes/no answer on whether there is a PHP method to move on with script or timeout gracefully before the fatal error.


thanks for the enthusiasm but this sounds like a post most won't or can't answer.
I did see an article on the homepage about error handling posted yesterday that I will give a go through thanks.

????????????????????
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: fatal error on shell_cmd()

Post by Christopher »

(#10850)
Post Reply