Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


PhpSecLib return errors
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

PhpSecLib return errors

JohnRoeJohnRoe Member
edited January 2015 in Help

Sorry if this question is little bit out of topic. But I need help to overcome this problem fast.

Im trying to add ssh user to 4 of my server with PHP. At first, I tried with 2 server. I simply run adduser command and the page loading pretty slow. It is still acceptable.

So I add 2 more server and the page loading goes up to 300secs. So I increase my maximum php execution to unlimited. Then, weird error start to fill in my log.

$ Premature end of script headers: add.php
$ (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server

after minutes of loading, my browser shows 500 interval error

I just ran simple command which is adduser john -M -s /bin/ssh_user && echo john:abc12345 | chpasswd

It goes pretty well with 2 servers.. When I add 4 servers, the script dead.
Is there any fix? or any better way to add ssh user via php?

Comments

  • BlueVMBlueVM Member
    edited January 2015

    So I'd consider myself the resident expert on PHPSecLib. Ideally you want to launch multiple instances of PHP here... one per connection. I'd look into something like pcntl_fork() so that you can do all 4 connections at the same time. PHPSecLib doesn't scale well within a single execution and should either be separated into multiple processes or page loads.

    Your actual is this: http://stackoverflow.com/questions/4336757/500-server-error-premature-end-of-script-headers which has nothing to do with PHPSecLib... but instead is essentially a different time out (FCGI timout).

  • What does your PHP script look like?

  • @BlueVM said:
    So I'd consider myself the resident expert on PHPSecLib. Ideally you want to launch multiple instances of PHP here... one per connection. I'd look into something like pcntl_fork() so that you can do all 4 connections at the same time. PHPSecLib doesn't scale well within a single execution and should either be separated into multiple processes or page loads.

    Your actual is this: http://stackoverflow.com/questions/4336757/500-server-error-premature-end-of-script-headers which has nothing to do with PHPSecLib... but instead is essentially a different time out (FCGI timout).

    So, phpseclib doesnt fit well with multiple server right?

    you said using pcntl_fork() can execute the command on all server at the same time. This is what I need since 2 server made my php script loading longer. Thank you very much. Ill take a look at the link

  • JohnRoeJohnRoe Member
    edited January 2015

    @PetaByet said:
    What does your PHP script look like?

    I wrote a function that I call for each server

    adduser(server1,username,password,command);

    adduser(server2,username,password,command);

    adduser(server3,username,password,command);

    adduser(server4,username,password,command);

    I know this is not eficient. I can barely use the script if it loading pretty long but works. But instead, it dies without successfully executing the command.
    Im in hurry because I have something to do with some of my server server at once that I dont have time to run them on each of them manually

Sign In or Register to comment.