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 7713187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:48:39+00:00 2026-06-01T01:48:39+00:00

I need to write a php script which is called by a setInterval( ajaxrequest(‘ftp.php’,

  • 0

I need to write a php script which is called by a setInterval( “ajaxrequest(‘ftp.php’, ‘context’)”, 1000 ); function. The php script is fairly easy. It’s countain an array of ftp addresses. It loop the array and check every ip address that is online or not.

Here is a sample code of the php script:

$conn_id = ftp_connect("192.168.1.108",21,1) or die ("Cannot connect to the server");
ftp_close($conn_id);

So basically what happens here: We have a javascript which calling a php script every second to check that the ftp servers are online or not. In the PHP script try to connect that if it cant it wrote out “Cannot connect to the server” then it closes the connection.

My problem is that i have to do this way, do not have any chance to use it by cron job because we need to check it trough a web page that the servers are online or not in real time. But in this way somewhere there is a memory leak its eats my memory really fast.

Is there any way that i can release the memory or solve this problem in an other way?

  • 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-06-01T01:48:41+00:00Added an answer on June 1, 2026 at 1:48 am

    consider this answer to be a suggestion and direction, I never had to do such things, but if i wore to face it.

    I would write a cron, that will scan the ftp port over an ip. This cron will run once every minute. The ftp’s that are not responding will be kept in db.

    I would make ajax requests to the php only to retrieve those data from the table.

    What this will do is allow to asynchronously execute the two major tasks

    • List all ftp’s not responding
    • update user with the list of ftp’s not responding

    Also, your method will have to find out list of ftp’s not working for every instance, and this will put even more strain on the server when multiple requests will be made. This way will make the resource hungry execution once, which will be valid for all 😀

    hope this helps…

    EDIT not sure if this adresses your cron dilemma, but do update

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

Sidebar

Related Questions

I am trying to write a php script which will insert an object into
I need to write php code to identify common e-mail errors, like inbox full
I need to write, in JavaScript (I am using jQuery), a function that is
I need to write a shell script to be scheduled to run daily to
I need to write a python script that makes multiple HTTP requests to the
I have script which allows the user to choose an image and write something
I need to run a PHP CLI script and give it a LOT of
For PHP testing scripts I need a function report() that will report results of
I'm looking to write a PHP script to act as a mini daemon to
I need a way to include an external XML file in PHP which does

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.