Ich habe derzeit ein Problem, wo ich versuche, ein Shell-Skript auszuführen, das eine Datei interpretiert und HTML zurückgibt, das Shell-Skript wird perfekt lokal ausgeführt, aber wenn ich über PHP ausführen, tut es nicht alles zurückgeben und es scheint, obwohl PHP es überhaupt nicht ausführt, habe ich eine Datei, die erstellt wird, wenn das Skript ausgeführt wird, die nicht mit PHP-Ausführung angezeigt wird. Ich habe andere Skripte, die mit PHP ausgeführt werden und vollständig funktionieren, und ich habe richtige www-Datenberechtigungen, um diese Datei auszuführen. Bitte helfen Sie mir, hier ist das Skript, das ich ausführen möchte und die PHP-Datei, die es ausführt.PHP + Shell Returning HTML
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<th style="font-size: 24px" scope="col"><p align="left" class="title_Font">Magnum Dongs <span style="font-size: 18px"> | Mighty Meat Sticks 4 Kidz</span></p></th>
</tr>
</tbody>
</table>
<ul align="center" width="1000" height="50">
<li><a href="#home">Home</a></li>
<li><a href="#news">Stories</a></li>
<li><a href="#contact">Memes</a></li>
<li><a href="#about">Shop</a></li>
<li><a href="#email">Email</a></li>
</ul>
<table width="1000" height="386" border="0" align="center" cellpadding="0" cellspacing="0" class="body_Main">
<tbody>
<?php
echo exec('./var/www/html/newdongs/fetch_html.sh');
?>
</tbody>
</table>
</body>
</html>
#!/usr/bin/env bash
python3 /bin/dongs/db_Read.py >> lines
#1
echo "<tr>"
echo "<th scope='col'>"
echo "table width='1000' border='0' class='post' align='center' style='margin-top: 10px;'>"
echo "<tbody>"
echo "<tr>"
echo "<th scope='col' width='50'>"
echo "<p style='font-size: 0px; margin:0px; ' align='center'> Posted By: "`awk 'NR==11' lines`"</p>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Total Score: "`awk 'NR==41' lines`"</p>"
echo "<img src='"`awk 'NR==31' lines`"' width='150' height='150' alt=''/>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Upvote | Downvote</p>"
echo "</th>"
echo "<th scope='col' align='left' valign='top'>"
echo "<p class='post' style='font-size: 14px'>"`awk 'NR==21' lines`"</p>"
echo "</tr>"
echo "</tbody>"
echo "</table></th>"
#2
echo "<tr>"
echo "<th scope='col'>"
echo "table width='1000' border='0' class='post' align='center' style='margin-top: 10px;'>"
echo "<tbody>"
echo "<tr>"
echo "<th scope='col' width='50'>"
echo "<p style='font-size: 0px; margin:0px; ' align='center'> Posted By: "`awk 'NR==12' lines`"</p>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Total Score: "`awk 'NR==42' lines`"</p>"
echo "<img src='"`awk 'NR==32' lines`"' width='150' height='150' alt=''/>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Upvote | Downvote</p>"
echo "</th>"
echo "<th scope='col' align='left' valign='top'>"
echo "<p class='post' style='font-size: 14px'>"`awk 'NR==22' lines`"</p>"
echo "</tr>"
echo "</tbody>"
echo "</table></th>"
#3
echo "<tr>"
echo "<th scope='col'>"
echo "table width='1000' border='0' class='post' align='center' style='margin-top: 10px;'>"
echo "<tbody>"
echo "<tr>"
echo "<th scope='col' width='50'>"
echo "<p style='font-size: 0px; margin:0px; ' align='center'> Posted By: "`awk 'NR==13' lines`"</p>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Total Score: "`awk 'NR==43' lines`"</p>"
echo "<img src='"`awk 'NR==33' lines`"' width='150' height='150' alt=''/>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Upvote | Downvote</p>"
echo "</th>"
echo "<th scope='col' align='left' valign='top'>"
echo "<p class='post' style='font-size: 14px'>"`awk 'NR==23' lines`"</p>"
echo "</tr>"
echo "</tbody>"
echo "</table></th>"
#4
echo "<tr>"
echo "<th scope='col'>"
echo "table width='1000' border='0' class='post' align='center' style='margin-top: 10px;'>"
echo "<tbody>"
echo "<tr>"
echo "<th scope='col' width='50'>"
echo "<p style='font-size: 0px; margin:0px; ' align='center'> Posted By: "`awk 'NR==14' lines`"</p>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Total Score: "`awk 'NR==44' lines`"</p>"
echo "<img src='"`awk 'NR==34' lines`"' width='150' height='150' alt=''/>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Upvote | Downvote</p>"
echo "</th>"
echo "<th scope='col' align='left' valign='top'>"
echo "<p class='post' style='font-size: 14px'>"`awk 'NR==24' lines`"</p>"
echo "</tr>"
echo "</tbody>"
echo "</table></th>"
#5
echo "<tr>"
echo "<th scope='col'>"
echo "table width='1000' border='0' class='post' align='center' style='margin-top: 10px;'>"
echo "<tbody>"
echo "<tr>"
echo "<th scope='col' width='50'>"
echo "<p style='font-size: 0px; margin:0px; ' align='center'> Posted By: "`awk 'NR==15' lines`"</p>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Total Score: "`awk 'NR==45' lines`"</p>"
echo "<img src='"`awk 'NR==35' lines`"' width='150' height='150' alt=''/>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Upvote | Downvote</p>"
echo "</th>"
echo "<th scope='col' align='left' valign='top'>"
echo "<p class='post' style='font-size: 14px'>"`awk 'NR==25' lines`"</p>"
echo "</tr>"
echo "</tbody>"
echo "</table></th>"
#6
echo "<tr>"
echo "<th scope='col'>"
echo "table width='1000' border='0' class='post' align='center' style='margin-top: 10px;'>"
echo "<tbody>"
echo "<tr>"
echo "<th scope='col' width='50'>"
echo "<p style='font-size: 0px; margin:0px; ' align='center'> Posted By: "`awk 'NR==16' lines`"</p>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Total Score: "`awk 'NR==46' lines`"</p>"
echo "<img src='"`awk 'NR==36' lines`"' width='150' height='150' alt=''/>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Upvote | Downvote</p>"
echo "</th>"
echo "<th scope='col' align='left' valign='top'>"
echo "<p class='post' style='font-size: 14px'>"`awk 'NR==26' lines`"</p>"
echo "</tr>"
echo "</tbody>"
echo "</table></th>"
#7
echo "<tr>"
echo "<th scope='col'>"
echo "table width='1000' border='0' class='post' align='center' style='margin-top: 10px;'>"
echo "<tbody>"
echo "<tr>"
echo "<th scope='col' width='50'>"
echo "<p style='font-size: 0px; margin:0px; ' align='center'> Posted By: "`awk 'NR==17' lines`"</p>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Total Score: "`awk 'NR==47' lines`"</p>"
echo "<img src='"`awk 'NR==37' lines`"' width='150' height='150' alt=''/>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Upvote | Downvote</p>"
echo "</th>"
echo "<th scope='col' align='left' valign='top'>"
echo "<p class='post' style='font-size: 14px'>"`awk 'NR==27' lines`"</p>"
echo "</tr>"
echo "</tbody>"
echo "</table></th>"
#8
echo "<tr>"
echo "<th scope='col'>"
echo "table width='1000' border='0' class='post' align='center' style='margin-top: 10px;'>"
echo "<tbody>"
echo "<tr>"
echo "<th scope='col' width='50'>"
echo "<p style='font-size: 0px; margin:0px; ' align='center'> Posted By: "`awk 'NR==18' lines`"</p>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Total Score: "`awk 'NR==48' lines`"</p>"
echo "<img src='"`awk 'NR==38' lines`"' width='150' height='150' alt=''/>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Upvote | Downvote</p>"
echo "</th>"
echo "<th scope='col' align='left' valign='top'>"
echo "<p class='post' style='font-size: 14px'>"`awk 'NR==28' lines`"</p>"
echo "</tr>"
echo "</tbody>"
echo "</table></th>"
#9
echo "<tr>"
echo "<th scope='col'>"
echo "table width='1000' border='0' class='post' align='center' style='margin-top: 10px;'>"
echo "<tbody>"
echo "<tr>"
echo "<th scope='col' width='50'>"
echo "<p style='font-size: 0px; margin:0px; ' align='center'> Posted By: "`awk 'NR==19' lines`"</p>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Total Score: "`awk 'NR==49' lines`"</p>"
echo "<img src='"`awk 'NR==39' lines`"' width='150' height='150' alt=''/>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Upvote | Downvote</p>"
echo "</th>"
echo "<th scope='col' align='left' valign='top'>"
echo "<p class='post' style='font-size: 14px'>"`awk 'NR==29' lines`"</p>"
echo "</tr>"
echo "</tbody>"
echo "</table></th>"
#10
echo "<tr>"
echo "<th scope='col'>"
echo "table width='1000' border='0' class='post' align='center' style='margin-top: 10px;'>"
echo "<tbody>"
echo "<tr>"
echo "<th scope='col' width='50'>"
echo "<p style='font-size: 0px; margin:0px; ' align='center'> Posted By: "`awk 'NR==20' lines`"</p>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Total Score: "`awk 'NR==50' lines`"</p>"
echo "<img src='"`awk 'NR==40' lines`"' width='150' height='150' alt=''/>"
echo "<p style='font-size: 0px; margin: 0px; ' align='center'> Upvote | Downvote</p>"
echo "</th>"
echo "<th scope='col' align='left' valign='top'>"
echo "<p class='post' style='font-size: 14px'>"`awk 'NR==30' lines`"</p>"
echo "</tr>"
echo "</tbody>"
echo "</table></th>"
Danke für die Hilfe im Voraus!
statt exec() versucht, mit system() –
Ich versuchte System() statt, immer noch nichts. Alle Skripte haben chmod 777, also haben sie definitiv Ausführungsrechte. –
Es könnte so viele Dinge geben, die das verursachen. Hast du wenigstens den Pfad überprüft, um sicherzustellen, dass "python3" und "awk" drin sind? Sehen Sie sich das Ergebnis Ihrer Anrufe an, um festzustellen, ob ein Fehler vorliegt? –