Jump to content
Larry Ullman's Book Forums

What Is A Shell_Exec() Error?


Recommended Posts

Does anyone know what the following error means:

 

An error occurred in script '/home/tueslcom/public_html/ecommerce/create_profile.php' on line 96:

shell_exec() has been disabled for security reasons

 

It is being generated by the following line:

 

$reg_errors[`directory_name`] = `Directory ` . $dn . ` already exists.`;

 

This code is nested down in a few if-else statements. I have tried many combinations (i.e. `Directory already exists`,

"Directory already exists", etc...), but to no avail! My only guess is that perhaps variable scope is being lost for $reg_errors,

but that doesn`t really make sense since the array is being defined at the top of the file.

 

Thanks for any help anyone can give!

 

Matt

Link to comment
Share on other sites

Are you running PHP in safe mode?

 

Thanks Jonathon!

 

I have seen a warning about that too! I am on a hosted server and I think I am running in safe mode.

 

Why does safe mode matter? All I`m doing is passing a string to an array, which I`ve done all the

way through the code without any trouble! Errors like this are simply ridiculous!

Link to comment
Share on other sites

Thanks again Jonathon!

 

Yeah, this is both perplexing, and frustrating! Perhaps someone else (i.e. Larry - since this is essentially your code) has an idea of what`s going on.

 

Thanks,

 

Matt

Link to comment
Share on other sites

My host has a secured php.ini configuration as well, the only way around this is to either use your own php.ini file that matches your version of php OR switch to a different host.

 

Safe mode is like training wheels for php, it should only ever be used in a testing situation when making sure php is working correctly it should NEVER be on in a production environment.

Most things we would use php for won't work in safe mode.

 

Also register globals should be turned off in the php.ini file as well, my host has it turned on. Fortunately I was able to figure out how to get a copy of php.ini running on my host and changed a lot of the settings so they work how I need them to and then configured my htaccess file to use my version of the php.ini file.

 

Otherwise I would have had to go to php.net and download the closest if not exact version my host uses for php and start with the default php.ini file. Unfortunately the version of php my host uses isn't available any longer at php.net and there are some minor differences to php.ini in later versions.

 

You can also set individual parameters inside of htaccess file but I have never really messed with that much.

  • Upvote 1
Link to comment
Share on other sites

I have a feeling that this issue is related to something that you're not showing us. Given the other post (that you made alongside this one) in which you were using grave accent marks in your query, I'm betting that that may be the issue. Try it out, and see what happens.

  • Upvote 1
Link to comment
Share on other sites

This is actually simpler than one would think but my thanks to everyone for trying to help out. In your code you use the backtick character ` instead of the single quotation mark or apostrophe. The backtick character in PHP is for executing a shell script command.

Link to comment
Share on other sites

 Share

×
×
  • Create New...