Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [HTML][PHP]Nie zwraca
Forum PHP.pl > Forum > Przedszkole
szymon202
  1. <?php
  2. if($_POST['send_ftp']) {
  3. $domain = htmlspecialchars($_POST['domain']);
  4. $ftpuser = htmlspecialchars($_POST['ftpuser']);
  5. $ftppass = htmlspecialchars($_POST['ftppass']);
  6. $connection = ssh2_connect('xxx.xx.xxx.x', 22);
  7. ssh2_auth_password($connection, 'root', 'haslossh');
  8. $stream = ssh2_exec($connection, "v-add-web-domain-ftp admin $domain $ftpuser $ftppass");
  9. if($connection) {
  10. echo 'ok';
  11. }else{
  12. echo 'failed';
  13. }
  14. }
  15. <form action="test.php" method="post">
  16. <input type="text" name="domain" value="domena">
  17. <input type="text" name="ftpuser" value="login">
  18. <input type="password" name="ftppass" value="haslo">
  19. <input name="send_ftp" type="submit" class="btn btn-primary" value="Dodaj">
  20. </form>
  21. ';
  22. ?>


Dlaczego ten kod mi nic nie zwraca?
buliq
sprawdź w error log i zdefiniuj nic nie zwraca
szymon202
Cytat(buliq @ 9.02.2015, 19:08:33 ) *
sprawdź w error log i zdefiniuj nic nie zwraca


A gdzie mam ten errorlog? Debian 7 64 bit
buliq
prawdopodobnie:
/var/log/php_errors.log
/var/log/apache2/error.log

albo w innym katalogu zgodnie z Twoja konfiguracją
szymon202
Cytat(buliq @ 9.02.2015, 19:11:38 ) *
prawdopodobnie:
/var/log/php_errors.log
/var/log/apache2/error.log

albo w innym katalogu zgodnie z Twoja konfiguracją


[Sun Feb 08 03:12:11 2015] [notice] mod_ruid2/0.9.7 enabled
[Sun Feb 08 03:12:11 2015] [notice] Apache/2.2.22 (Debian) mod_fcgid/2.3.6 PHP/5.4.36-0+deb7u3 mod_ssl/2.2.22 OpenSSL/1.0.1e configured -- resuming normal operations
[Sun Feb 08 14:07:23 2015] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Sun Feb 08 14:07:34 2015] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Sun Feb 08 14:07:45 2015] [error] (12)Cannot allocate memory: fork: Unable to fork new process
[Mon Feb 09 10:55:26 2015] [notice] caught SIGTERM, shutting down
[Mon Feb 09 10:55:58 2015] [notice] suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Mon Feb 09 10:55:59 2015] [notice] mod_ruid2/0.9.7 enabled
[Mon Feb 09 10:56:00 2015] [notice] Apache/2.2.22 (Debian) mod_fcgid/2.3.6 PHP/5.4.36-0+deb7u3 mod_ssl/2.2.22 OpenSSL/1.0.1e configured -- resuming normal operations
[Mon Feb 09 13:16:21 2015] [notice] caught SIGTERM, shutting down
[Mon Feb 09 13:16:56 2015] [notice] suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Mon Feb 09 13:16:57 2015] [notice] mod_ruid2/0.9.7 enabled
[Mon Feb 09 13:16:57 2015] [notice] Apache/2.2.22 (Debian) mod_fcgid/2.3.6 PHP/5.4.36-0+deb7u3 mod_ssl/2.2.22 OpenSSL/1.0.1e configured -- resuming normal operations

Błąd po włączeniu flag błędów
Notice: Undefined index: send_ftp in /home/admin/web/xxxx.pl/public_html/test.php on line 6
Po naciśnięciu dodaj:
Fatal error: Call to undefined function ssh2_connect() in /home/admin/web/xxxx.pl/public_html/test.php on line 10

W pierwszym błędzie dałem $_POST w isset, a w drugim musiałem zainstalować liby
Kod
apt-get install libssh2-php

Kod
/etc/init.d/apache2 restart
phpion
Proszę nadać tematowi sensowny tytuł. W przeciwnym razie zostanie zamknięty.

// Edit:
Cytat
Ostatnio widziany: Dzisiaj, 13:43

Prośba zignorowana więc wątek zamykam.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.