Shell_exec() has been disabled for security reasons

I’m getting the error shell_exec() has been disabled for security reasons, I looked through the forums so yea I get I can’t call it, so how do I do what I’m trynna do?
The error shows on this line:
$values = `$displayName,$username,$password,$phoneNumber,$email`;
These variables are declared as

                    $username = $_POST["username"];
                    $password = $_POST["password"];
                    $phoneNumber = $_POST["phoneNumber"];
                    $email = $_POST["email"];```

If you cannot use shell_exec() due to security restrictions, you need to find an alternative approach to achieve your desired functionality. From the code snippet you provided, it appears that you are attempting to create a comma-separated string of values. Instead of using backticks (```) for shell execution, you can create the string directly using PHP.

To create the comma-separated string, you can use PHP’s implode() function, which joins elements of an array with a string (in this case, a comma). Here’s how you can modify your code:

// Assuming these variables are already defined as you mentioned in your code:
$username = $_POST["username"];
$password = $_POST["password"];
$phoneNumber = $_POST["phoneNumber"];
$email = $_POST["email"];

// Create an array of values
$valuesArray = array($displayName, $username, $password, $phoneNumber, $email);

// Convert the array into a comma-separated string
$values = implode(",", $valuesArray);

Now, the $values variable will contain the comma-separated string of values, and you can use it as needed in your application.

Also, in the code snippet you provided, the variable $displayName is not defined. I simply used that as a filler. Make sure to define it before using it in your array.

By using implode(), you avoid the need for shell_exec() and achieve the same result of creating a comma-separated string. This approach is safe and does not rely on executing shell commands, making it compatible with many server configurations.

EDIT:
I am very limited as to how much help I can provide you on the coding side of things, as I believe this forum is designed for web and/or domain functionality assistance and the like, rather than coding directly.

5 Likes

You cannot. Consider upgrading to premium hosting?

1 Like

Okay array does work for this particular thing
And upgrading to premium hosting doesn’t since I’m poor af and it’s absolutely not neccesary
But in general I just gotta use $x . ‘y’ . $z instead of $xy$z, which well is annoying but it works, thank you either way, 1Truth

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.