N
N
Nadim Zakirov2020-05-29 14:32:28
PHP
Nadim Zakirov, 2020-05-29 14:32:28

Why does Open Server write that $_POST does not exist?

I was able to catch a very strange error in Open Server, after a certain (large) number of sent requests, at some point it stops returning the result for the $_POST variable, it looks like this:

Notice : Undefined variable: _POST in C:\OpenServer\domains\proxy\index.php on line 13

<?php

header('Access-Control-Allow-Origin: *'); // Разрешаем запросы с любых доменов
header('Content-Type: text/html; charset=utf-8'); // Указываем тип документа и кодировку

// Включаем отображение ошибок:

ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);

  
print_r($_POST); // Это и есть 13-ая строка


I don't understand what the hell is going on. If you restart the server, everything suddenly becomes normal, but I need continuous work! What should I do and how should I be? There is no nichrome in the Apache logs, not a single hint at the root of the problem. Can this behavior cause an SSL certificate generated by myself for the local domain? Or too much use of file_get_contents() always with different stream context?

From the strange, I see that for some reason I have two Apaches running in the dispatcher, as if the server tried to reboot on the fly and could not, but this is the only tip that I could dig up, it’s not a fact that this is the case.

5ed0f3f6a5601151362581.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
ThunderCat, 2020-05-29
@ThunderCat

Well, try it in order:
1) Disable the certificate
2) Check that the request method is post (in the browser, see the network, in the code you do var_dump server request method)
3) there is a suspicion that the redirect works (why is another question), so carefully look at paragraph 2
below according to the circumstances.

P
profesor08, 2020-05-29
@profesor08

Drop your openserver and execute the command in the project folder php -S 0.0.0.0:80 -t "%cd%", the local webserver will start. Once you are sure that everything works as expected, you can delete the open server and forget about it. You don't need it for local development, just like Apache.

A
Anton Shamanov, 2020-05-29
@SilenceOfWinter

pthreads to help + you need to understand that such projects out of the box are not designed for offloaded projects and you didn’t even think of switching to ngnix from the same box ..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question