Понятия не имею, что произошло, но я передал наш существующий веб-сайт wordpress с большим количеством настраиваемого кода php / curl / javascript / jquery другому хостинг-провайдеру, поскольку нам нужно было больше скорости / пропускной способности.
Я сам переместил веб-сайт, и все работает так, как должно, за исключением специального приложения, которое мы запрограммировали в нашей среде wordpress.
Когда мы пытаемся отправить форму, мы получаем следующую ошибку в нашей консоли:
POST https://verifiedcryptogroup.com/member-area/api/create_user.php 500 ()
send @ jquery.js?ver=1.12.4:4
ajax @ jquery.js?ver=1.12.4:4
(anonymous) @ (index):2599
dispatch @ jquery.js?ver=1.12.4:3
r.handle @ jquery.js?ver=1.12.4:3
Как видите, мы получаем внутреннюю ошибку сервера (500), не более того.
Это проблема хостинг-провайдера?
вот код ниже 'create_user.php'
<?php
include('functions.php');
// First we get all the information from the fields we need to pass on to
swiftdill.
$type = $_POST['type'];
$email = $_POST['email'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$title = $_POST['title'];
$middle_name = $_POST['middle_name'];
$maiden_name = $_POST['maiden_name'];
$dob = $_POST['dob'];
$gender = $_POST['gender'];
$mobile = $_POST['mobile'];
$nationality = $_POST['nationality'];
$birth_country = $_POST['birth_country'];
$line = $_POST['line'];
$extra_line = $_POST['extra_line'];
$city = $_POST['city'];
$state_or_province = $_POST['state_or_province'];
$postal_code= $_POST['postal_code'];
$country = $_POST['country'];
$wp_id = $_POST['wp_id'];
if (isset($type) && $type != '') {
$fields = array(
'type' => $type,
'email' => $email,
'first_name' => $first_name,
'last_name' => $last_name,
'title' => $title,
'middle_name' => $middle_name,
'maiden_name' => $maiden_name,
'dob' => $dob,
'gender' => $gender,
'mobile' => $mobile,
'nationality' => $nationality,
'birth_country' => $birth_country,
'addresses' => [ array(
'type' => 'PRIMARY',
'line' => $line,
'extra_line'=> $extra_line,
'city' => $city,
'state_or_province' => $state_or_province,
'postal_code'=> $postal_code,
'country' => $country
)]
);
$fields = json_encode($fields);
// Get the access token and make sure it's not empty
$newToken = getAccessToken($api_url);
// Check if the token is empty. If so: give a message and stop the script.
if (empty($newToken)) {
echo '{ "error": "The token is invalid!" }';
return;
} else {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $api_url . "customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $fields,
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer $newToken",
"Cache-Control: no-cache",
"Content-Type: application/json",
"Postman-Token: xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx"
)
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo '{ "error": "cURL Error #:' . $err . '" }';
} else {
$result = json_decode($response, true);
if ($result['id'] != '' && $result['email'] != '') {
// De zojuist aangemaakte gebruiker wordt toegevoegd aan de eigen database
$addCustomerId = addCustomerId($db, $wp_id, $result['id']);
if ($addCustomerId == 'success') {
echo '{ "message": "success" }';
} else {
echo $response;
}
} else {
echo $response;
}
}
}
} else {
echo '{ "error": "Type incorrect" }';
}
И отслеживайте свой код, добавляйте отпечатки, отлаживайте!
Уже сделал. Никаких ошибок или чего-либо еще в журналах ошибок. . . Чей-то совет?
Вы проверили, включено ли расширение PHP-curl на вашем новом сервере?






Fixing 500 Internal Server Error Problems on Your Own Site A 500 Internal Server Error on your own website requires a completely different course of action. As we mentioned above, most 500 errors are server-side errors, meaning it's likely your problem to fix if it's your website.
There are lots of reasons why your site might be serving a 500 Error to your users, but these are the most common:
A Permissions Error. In most cases, a 500 Internal Server Error is due to an incorrect permission on one or more files or folders. In most of those cases, an incorrect permission on a PHP and CGI script is to blame. These should usually be set at 0755 (-rwxr-xr-x). A PHP Timeout. If your script connects to external resources and those resources timeout, an HTTP 500 error can occur. Timeout rules, or better error handling in your script, should help if this is the cause of the 500 error. A Coding Error in .htaccess. While not as common, be sure to check that your site's .htaccess file is properly structured. If you're running WordPress, Joomla, or another content management or CMS system, be sure to search their support centers for more specific help troubleshooting a 500 Internal Server Error.
If you're not using an off-the-shelf content management tool, your web hosting provider, like InMotion, Dreamhost, 1&1, etc., probably has some 500 Error help that might be more specific to your situation.
Источник: https://www.lifewire.com/500-internal-server-error-explained-2622938
Проверил мои журналы ошибок и тому подобное, никаких странных вещей там нет.
500 ошибок могут быть чем угодно. Попробуйте поискать журналы ошибок в apache / nginx, самом php, может быть, в wordpress есть какие-то. Вероятно, в одном из них будет довольно подробная ошибка, которая соответствует вашему поведению.