Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6647343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:31:33+00:00 2026-05-26T00:31:33+00:00

We have a bunch of cli cron style scripts that are coded in php.

  • 0

We have a bunch of cli cron style scripts that are coded in php.

A few of these services use ftp to send data to remote locations.

The way things are set up, what happens quite frequently is:

a) Script start
b) Connect to ftp @ remote location
c) Send data
d) Close ftp connection
e) Terminate script
f) Return to A, repeat, within a short amount of time and send to the same target, but different data.

The issue is that there is quite a bit of overhead (read: slowdown) due to step b, where it first has to connect to the ftp server, login, make sure the folder exists, if not create it, etc etc… I know I know, the right way to do things would be to consolidate these transfers into single pushes… But its far more complicated then that. I simplified about 30-40 steps from here.

So what I was hoping on doing is setting up a system like this:

[ CRON CLI SCRIPT ] --->

[ LOCALLY HOSTED SOCKET BASED SERVER THAT KEEPS THE FTP CONNECTIONS OPEN ] --->

[ REMOTE FTP ]

With the above, we can keep the locally hosted socket based server running, and the ftp connections open and we would skip what is the longest part of the process, the ftp authentication related items.

While setting this up for a ‘one at a time’ style system in PHP is fairly trivial, what I have never done before is making this as close to multi threaded as possible.

Where by, the socket is opened (for example, 127.0.0.1:10000), and multiple requests can come in. If needed, ‘children’ are spawned, new ftp connections made, etc etc.

Can anyone shed some insight into making this multi threaded in php, OR, if there is another better solution out there? Perl is an option. Its been years (YEARS…) since I have touched it, but I am sure a couple days in front of some good docs would bring me up to speed enough to make it happen.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:31:34+00:00Added an answer on May 26, 2026 at 12:31 am

    We have build a system that does more or less what you want. So, it is definitely possible to build a multi-process application in PHP.

    It is however, not trivial. If you fork off a child process, you need to very carefully manage your remote connections in order to avoid problems. (use the socket_* family of functions instead of fsockopen for better control)

    Also, Signals, tend to interrupt your normal program flow. This is off course normal, but PHP was not build with this in mind -> be prepared for some unexpected results.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have bunch of objects that return a DOM-tree that I then use to
week DKK id=radio2 value=75 /> I have bunch of these div entry generated by
I have a bunch of files that I need to be able to transport
I have a bunch of latitude/longitude pairs that map to known x/y coordinates on
I have a bunch of .NET frameworks installed on my machine. I know that
I have a bunch of perfmon files that have captured information over a period
I have a bunch (hundreds) of files that are supposed to have Unix line
I have bunch of ruby scripts in a git repository and it seems to
I have a bunch of records in my Advantage Database that ended up with
I have a bunch of PDFs that I'm just trying to open, resize the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.