'downloading', 'size' => filesize($zipFile) ]); } else { echo json_encode(['status' => 'not_started']); } break; } exit; } // Functions function downloadWordPress($url, $destination) { if (file_exists($destination)) { unlink($destination); } $ch = curl_init($url); $fp = fopen($destination, 'wb'); if ($fp === false) { return [ 'success' => false, 'message' => 'Unable to create file. Check write permissions.' ]; } curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_TIMEOUT, 300); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $error = curl_error($ch); curl_close($ch); fclose($fp); if ($result === false || $httpCode != 200) { if (file_exists($destination)) { unlink($destination); } return [ 'success' => false, 'message' => "Download failed: $error (HTTP $httpCode)" ]; } $fileSize = filesize($destination); $fileSizeMB = round($fileSize / (1024 * 1024), 2); return [ 'success' => true, 'message' => "Download completed successfully! ($fileSizeMB MB)", 'size' => $fileSizeMB ]; } function extractZip($zipFile, $extractTo) { if (!file_exists($zipFile)) { return [ 'success' => false, 'message' => 'Zip file not found.' ]; } if (!class_exists('ZipArchive')) { return [ 'success' => false, 'message' => 'ZipArchive extension not available on this server.' ]; } $zip = new ZipArchive; $res = $zip->open($zipFile); if ($res !== true) { return [ 'success' => false, 'message' => 'Failed to open zip file.' ]; } $zip->extractTo($extractTo); $numFiles = $zip->numFiles; $zip->close(); return [ 'success' => true, 'message' => "Extracted $numFiles files successfully!", 'files' => $numFiles ]; } function deleteZipFile($zipFile) { if (!file_exists($zipFile)) { return [ 'success' => false, 'message' => 'Zip file not found.' ]; } if (unlink($zipFile)) { return [ 'success' => true, 'message' => 'Zip file deleted successfully!' ]; } else { return [ 'success' => false, 'message' => 'Failed to delete zip file.' ]; } } function deleteSelf() { $selfFile = __FILE__; // Use a delayed deletion approach // This will be executed after the response is sent if (unlink($selfFile)) { return [ 'success' => true, 'message' => 'Installer script deleted successfully!' ]; } else { return [ 'success' => false, 'message' => 'Failed to delete installer script. You can manually delete it.' ]; } } ?> WordPress Downloader & Installer

WordPress Installer

Download, extract, and install WordPress with one click

✓
✗
Ready to download WordPress. Click the button below to start.
Installation Complete!
WordPress has been extracted to the current directory. You can now proceed with the WordPress installation by visiting your website.