problems with system()

roelmb

New Member
Messages
4
Reaction score
0
Points
0
I'm getting this error


Warning: system() has been disabled for security reasons in /home/roelmb/public_html/ps-troepentool2/updater.php on line 20
Failed downloading http://s6.travian.nl/map.sql or the file could not be saved due to file system permission restrictions!

Code:
 // load the map.sql via system command using "wget" into the folder data/
 // IMPORTANT: PHP has to be allowed to write into that folder, if necessary set the needed rights! 
 system('wget '.$travian_db_dump.' -O data/tmp.sql');

Is their a solution for this problem. I already put the permission on the folder too writing is their something else I need to do


Is it possible to download the file with cron
 
Last edited:

descalzo

Grim Squeaker
Community Support
Messages
9,375
Reaction score
327
Points
83
PHP's cURL library....

PHP:
$ch = curl_init("http://s6.travian.nl/map.sql");

// assuming data is a subdirectory of the directory where script is located...

$fp = fopen("data/tmp.sql", "w");  

curl_setopt($ch, CURLOPT_FILE, $fp);

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);

curl_close($ch);

fclose($fp);

PHP Manual section on cURL
 
Last edited:

Twinkie

Banned
Messages
1,389
Reaction score
12
Points
0
The answer is in the warning. In a shared hosting, the system function poses a security risk to the servers, therefore it is disabled. There is no solution except to use another method, such as the cURL library as descalzo suggested (if that works I have not tested myself).
 

xav0989

Community Public Relation
Community Support
Messages
4,467
Reaction score
95
Points
0
Dokuwiki uses sockets (if I remember well) and works on x10.
 
Top