Es scheint, als könnte ich mit meinem PHP-Skript auf meinem VPS nichts anfangen.
Wenn ich versuche, etwas in ein Verzeichnis hochzuladen, wird die Meldung „Zugriff verweigert“ zurückgegeben.
Ja, ich habe die Berechtigung auf 777 geändert und es funktioniert, aber ich mag die Unsicherheit nicht
Beim Ausführen des Befehls:
ps axu|grep apache|grep -v grep
Es kehrt zurück
nobody 7689 0.1 3.8 50604 20036 ? S 21:38 0:00 /usr/local/apache/bin/httpd -k start -DSSL
root 13600 0.0 3.8 50304 20348 ? Ss Jun06 0:46 /usr/local/apache/bin/httpd -k start -DSSL
nobody 15733 0.1 3.8 50700 20156 ? S 21:39 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 15818 0.1 3.8 51492 20180 ? S 21:39 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 23843 0.1 3.7 51336 19592 ? S 21:40 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 30335 0.0 3.5 50436 18496 ? S 21:41 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 30406 0.0 3.5 50444 18544 ? S 21:41 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 30407 0.0 3.5 50556 18696 ? S 21:41 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 30472 0.0 3.6 50828 19348 ? S 21:41 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 30474 0.0 3.5 50668 18868 ? S 21:41 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 30476 0.0 3.6 50532 19064 ? S 21:41 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 30501 0.0 3.8 50556 20080 ? S 21:36 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 32341 0.0 3.5 50444 18492 ? S 21:41 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 32370 0.0 3.5 50444 18476 ? S 21:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 32414 0.1 3.7 51336 19524 ? S 21:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 32416 0.1 3.5 50668 18816 ? S 21:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 32457 0.1 3.6 50828 19320 ? S 21:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 32458 0.1 3.6 50772 19276 ? S 21:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 32459 0.0 3.5 50444 18504 ? S 21:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 32460 0.2 3.6 50828 19320 ? S 21:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 32463 0.0 3.5 50444 18472 ? S 21:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 32466 0.0 3.4 50436 17960 ? S 21:42 0:00 /usr/local/apache/bin/httpd -k start -DSSL
Der Besitzer des Verzeichnisses ist „Benutzer [505]“ und die Gruppe ist „Benutzer [508]“ (wie in WinSCP angezeigt).
Was kann ich tun, um den Apache-Handler auf den richtigen Besitzer und die richtige Gruppe zu ändern, damit meine PHP-Skripte funktionieren?
PS
Mein PHP ist nicht auf den abgesicherten Modus eingestellt und das open_basedir ist aufkein Wert
BEARBEITEN:
So sieht meine httpd.conf aus (für die assoziative Domäne)
<VirtualHost *:80>
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /home/domain/public_html
ServerAdmin info@domain
## User <theUsername> # Needed for Cpanel::ApacheConf
<IfModule mod_userdir.c>
Userdir disabled
Userdir enabled <userName>
</IfModule>
<IfModule mod_suphp.c>
suPHP_UserGroup <userName> <userName>
</IfModule>
<IfModule !mod_disable_suexec.c>
SuexecUserGroup <userName> <userName>
</IfModule>
CustomLog /usr/local/apache/domlogs/domain.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
CustomLog /usr/local/apache/domlogs/domain.com combined
ScriptAlias /cgi-bin/ /home/domain/public_html/cgi-bin/
#Options -ExecCGI -Includes
#RemoveHandler cgi-script .cgi .pl .plx .ppl .perl
Antwort1
Es sind dieselben Rechte erforderlich wie für den Benutzer, der den Webserver betreibt. Dies hängt von Ihrem Betriebssystem ab. Es kann „Apache“ oder „www-data“ oder etwas ganz anderes sein.
Sofern Sie nichtsuEXEC, das Skript wird vom Webserver ausgeführt und läuft daher mit denselben Berechtigungen wie dieser Benutzer.
Um das Problem zu beheben, müssen Sie ermitteln, unter welchem Benutzer der Apache-Prozess ausgeführt wird, und den Dateien/Ordnern, die das Skript ändern dürfen soll, entsprechende Berechtigungen zuweisen.
Sie können die Benutzer- und Gruppenkonten, unter denen Apache ausgeführt wird, in Ihrer conf-Datei mit dem folgenden Befehl angeben:
User=[username]
Group=[groupname]
Richtlinien.
Schauen Sie in Ihre Conf-Datei. Name und Speicherort der Datei variieren je nach Betriebssystem. Wenn Sie hier etwas genauere Angaben machen, erhalten Sie möglicherweise eine direktere Antwort.
edit: für Centos befindet sich die conf-Datei in
/etc/httpd/conf/httpd.conf
Antwort2
AKTUALISIEREN!Wenn Sie dieses Problem auch haben, versuchen Sie Folgendes:
Gehen Sie in WHM zu:
Hauptseite >> Dienstkonfiguration >> Apache-Konfiguration >> PHP- und SuExec-Konfiguration
Ich habe mich verändert PHP 5 Handlerzu: suphp.
Hat super geklappt
Antwort3
Änderung in WHM Main >> Servicekonfiguration >> Apache-Konfiguration >> PHP- und SuExec-Konfiguration php hadler >> fcgi, das wird das Problem lösen.