![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/soundstudiopro.com/private_html/utils/ |
<?php
header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html>
<html>
<head>
<title>Fix Permissions - MusicStudio Pro</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
.success { color: green; }
.error { color: red; }
.warning { color: orange; }
pre { background: #f5f5f5; padding: 10px; border-radius: 5px; }
</style>
</head>
<body>
<h1>๐ง Fix Permissions & Test API</h1>
<?php
// Try to fix permissions
$files = ['api.php', 'diagnostic.php', 'test_api.php'];
echo "<h2>๐ Fixing File Permissions</h2>";
foreach ($files as $file) {
if (file_exists($file)) {
$oldPerms = fileperms($file);
$newPerms = 0644; // rw-r--r--
if (chmod($file, $newPerms)) {
echo "<p class='success'>โ
Fixed permissions for $file (was " . substr(sprintf('%o', $oldPerms), -4) . ", now " . substr(sprintf('%o', $newPerms), -4) . ")</p>";
} else {
echo "<p class='error'>โ Failed to fix permissions for $file</p>";
}
} else {
echo "<p class='warning'>โ ๏ธ File $file not found</p>";
}
}
echo "<h2>๐งช Testing API with HTTPS</h2>";
// Test API with proper HTTPS URL
$protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'];
$apiUrl = $protocol . '://' . $host . '/api.php';
echo "<p><strong>Testing API URL:</strong> $apiUrl</p>";
$testData = [
'action' => 'music',
'prompt' => 'A simple test melody',
'model' => 'v3',
'duration' => 10
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($testData));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);
echo "<p><strong>HTTP Code:</strong> $httpCode</p>";
if ($error) {
echo "<p class='error'>โ cURL Error: " . htmlspecialchars($error) . "</p>";
} else {
echo "<p><strong>Response:</strong></p>";
echo "<pre>" . htmlspecialchars($response) . "</pre>";
$result = json_decode($response, true);
if ($result) {
if (isset($result['success']) && $result['success']) {
echo "<p class='success'>โ
API is working correctly!</p>";
} else {
echo "<p class='error'>โ API Error: " . ($result['error'] ?? 'Unknown error') . "</p>";
// If it's a 503 error, show helpful message
if (strpos($result['error'], '503') !== false) {
echo "<div style='background: #fff3cd; border: 1px solid #ffeaa7; padding: 15px; border-radius: 5px; margin: 10px 0;'>";
echo "<h3>๐ API Status</h3>";
echo "<p>The API is currently experiencing issues (HTTP 503). This is a temporary problem on their end.</p>";
echo "<p><strong>What this means:</strong></p>";
echo "<ul>";
echo "<li>Your setup is working correctly</li>";
echo "<li>The issue is with the API servers</li>";
echo "<li>Try again in a few minutes</li>";
echo "</ul>";
echo "</div>";
}
}
} else {
echo "<p class='error'>โ Invalid JSON response</p>";
}
}
echo "<h2>๐ Quick Links</h2>";
echo "<ul>";
echo "<li><a href='musicstudio.html'>๐ต MusicStudio Pro</a></li>";
echo "<li><a href='diagnostic.php'>๐ง Server Diagnostic</a></li>";
echo "<li><a href='test_api.php'>๐งช API Test</a></li>";
echo "</ul>";
?>
</body>
</html>