Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Closed TopicStart new topic
> [HTML][PHP]Nie zwraca
szymon202
post 9.02.2015, 19:05:32
Post #1





Grupa: Zarejestrowani
Postów: 152
Pomógł: 0
Dołączył: 13.08.2013

Ostrzeżenie: (0%)
-----


  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?
Go to the top of the page
+Quote Post
buliq
post 9.02.2015, 19:08:33
Post #2





Grupa: Zarejestrowani
Postów: 559
Pomógł: 93
Dołączył: 4.03.2008
Skąd: Olsztyn

Ostrzeżenie: (0%)
-----


sprawdź w error log i zdefiniuj nic nie zwraca


--------------------
KTOŚ TU PACZY???

Kompedium wiedzy
Go to the top of the page
+Quote Post
szymon202
post 9.02.2015, 19:09:52
Post #3





Grupa: Zarejestrowani
Postów: 152
Pomógł: 0
Dołączył: 13.08.2013

Ostrzeżenie: (0%)
-----


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
Go to the top of the page
+Quote Post
buliq
post 9.02.2015, 19:11:38
Post #4





Grupa: Zarejestrowani
Postów: 559
Pomógł: 93
Dołączył: 4.03.2008
Skąd: Olsztyn

Ostrzeżenie: (0%)
-----


prawdopodobnie:
/var/log/php_errors.log
/var/log/apache2/error.log

albo w innym katalogu zgodnie z Twoja konfiguracją


--------------------
KTOŚ TU PACZY???

Kompedium wiedzy
Go to the top of the page
+Quote Post
szymon202
post 10.02.2015, 12:27:58
Post #5





Grupa: Zarejestrowani
Postów: 152
Pomógł: 0
Dołączył: 13.08.2013

Ostrzeżenie: (0%)
-----


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


Ten post edytował szymon202 10.02.2015, 12:39:43
Go to the top of the page
+Quote Post
phpion
post 11.02.2015, 08:34:19
Post #6





Grupa: Moderatorzy
Postów: 6 070
Pomógł: 860
Dołączył: 10.12.2003
Skąd: Dąbrowa Górnicza




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.
Go to the top of the page
+Quote Post

Closed TopicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 29.03.2024 - 14:07