What do return codes mean? Well, for example, I run the executable file in php, it returns 139 to me.
<?php echo '<pre>'; system('/home/re1aps/insert', $retval); echo ' </pre>' <hr />Kod vozvrata: ' . $retval;' ?>
The actual binary is:
#include <mysql.h> int main(int argc, char **argv) { MYSQL *conn; int len, size; char data[1000*1024]; char chunk[2*1000*1024+1]; char query[1024*5000]; FILE *fp; conn = mysql_init(NULL); mysql_real_connect(conn, "localhost", "root", "", "bd", 0, NULL, 0); fp = fopen("test.jpg", "rb"); size = fread(data, 1, 1024*1000, fp); mysql_real_escape_string(conn, chunk, data, size); int val1= 1 ,val2= 2; char stat[] = "INSERT INTO img(id, pic, name) VALUES(\'%d\', \'%s\', \'%d\')"; len = snprintf(query, sizeof(stat)+sizeof(chunk) , stat, val1, chunk, val2); mysql_real_query(conn, query, len); fclose(fp); mysql_close(conn); }
As a result, nothing starts and is not added. Yes, I know, all this can be done on pure php, but this is only part of the program, the main program is a complex calculation - with php this is either stupid or not realistic, rather the first. Yes, if you run everything from the console.
Ps But if I write an elementary code, then everything is ok. For example, I bring "hello world" to the console. The same is displayed in the browser, but it is worth a little more complicated and errors are added in the browser. Specifically, which were: 1, 127, 139, it seems to be the main ones, I did not find anything about them, what do they mean at all?