473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Force PHP CLI to stay in RAM?

Hello

I have a couple of command-line PHP scripts that are often called, and
I was wondering if it were possible to have the PHP interpreter remain
in RAM instead of being removed after the scipts end?

Thank you.
Dec 25 '07 #1
6 1499
Hi,

You can certainly do this. The script can sit in a loop waiting for an
indication to continue such as a socket connection, a file on disk
being modified, a posix signal, an update in a database, a timer, etc.

On Dec 24, 10:00 pm, Gilles Ganault <nos...@nospam.comwrote:
Hello

I have a couple of command-line PHP scripts that are often called, and
I was wondering if it were possible to have the PHP interpreter remain
in RAM instead of being removed after the scipts end?

Thank you.
Dec 25 '07 #2
Gilles Ganault wrote:
I have a couple of command-line PHP scripts that are often called, and
I was wondering if it were possible to have the PHP interpreter remain
in RAM instead of being removed after the scipts end?
If the script is called often enough, they *will* stay in memory. It's
something called "the operating system automatically caches the most
recently used files".

You are trying to do premature optimization. Don't.

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Las deudas son como los niños; cuanto más pequeñas, más ruido hacen.
Dec 25 '07 #3
On Tue, 25 Dec 2007 21:21:26 +0100, Iván Sánchez Ortega
<ivansanchez-alg@rroba-escomposlinux.-.punto.-.orgwrote:
>If the script is called often enough, they *will* stay in memory. It's
something called "the operating system automatically caches the most
recently used files".
OK, I'll just let Linux handle this, and come back if it's too slow
;-) I wanted to have your opinion because the scripts are used with a
PBX, so that timing is important.
Dec 26 '07 #4
Gilles Ganault wrote:
I wanted to have your opinion because the scripts are used with a
PBX, so that timing is important.
Then, keep the scripts short and use efficient algorithms. Knowing the
difference between O(n^2) and O(n*log(n)) is much more important than
keeping the script in memory.
That said, if you *really* need a real-time response on a mission-critical
environment, drop PHP altogether and switch to rtlinux, lighthttpd and a
custom C CGI.

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

MSN:i_*************************@hotmail.com
Jabber:iv*********@jabber.org ; iv*********@kdetalk.net
Dec 26 '07 #5
� wrote:
Gilles Ganault wrote:
>I wanted to have your opinion because the scripts are used with a
PBX, so that timing is important.

Then, keep the scripts short and use efficient algorithms. Knowing the
difference between O(n^2) and O(n*log(n)) is much more important than
keeping the script in memory.
That said, if you *really* need a real-time response on a mission-critical
environment, drop PHP altogether and switch to rtlinux, lighthttpd and a
custom C CGI.
:-)

he's right you know.

But real time usually just mens 'good enough' - only in real mans stuff
does it mean 'guaranteed to always be good enough'

i.e. you do NOT want your missile to decide to go memory garbage
collecting 5 ms after launch.. ;-)and self destruct when it misses a
watchdog timer..

Dec 26 '07 #6
On Wed, 26 Dec 2007 12:09:08 +0000, The Natural Philosopher <a@b.c>
wrote:
>But real time usually just mens 'good enough' - only in real mans stuff
does it mean 'guaranteed to always be good enough'
OK, I'll see how PHP does and see if timing is an issue. Thanks.
Dec 26 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: bdwise | last post by:
I have this in my style: #divNavigation { position: relative; overflow: hidden; align: right; vertical-align: top; text-align: center; width: 126;
2
by: michael | last post by:
Hi, folks - I am trying to build a macro that Outputs a query to Excel, then Auto Starts the Excel doc to show the query results. I'd like Excel to be the top window when this is done, but my...
4
by: Stan Sainte-Rose | last post by:
First, I thank you Herfried. I have 3 tabpages in a tabcontrol. I would like to force the user to stay in the current tabpage until he doesn't correctly fill some textboxes. I know how to...
4
by: Fei | last post by:
Hi, I got a simple question. I have my application running in Windows XP OS. Sometimes, there may be multiple apps running together at the same time. How can I force my app to the front, i.e....
1
by: veerleverbr | last post by:
Hi, In my VB.NET code, at a certain moment I set the cursor to the hourglass: Cursor = System.Windows.Forms.Cursors.WaitCursor Then a lot of things happen in my form, but also in other...
11
by: ago | last post by:
Inspired by some recent readings on LinuxJournal and an ASPN recipe, I decided to revamp my old python hack... The new code is a combination of (2) reduction methods and brute force and it is quite...
2
by: andychambers2002 | last post by:
I've written a simple Timer class that allows you to extend it and then implement onMinuteChange, onHourChange etc methods which will be executed on each new minute/hour respectively. It works...
2
by: cottonj | last post by:
is there anyway to force an event, like mouseover? I have a page that loads, and due to some complex js code (not mine) it fails to write labels to tabs until the user does a mouseover on the...
1
by: rahulnag22 | last post by:
Hi, I have a Tk() window "base_win = Tk()" with multiple frames on it having a combination of widgets. If I click on say a button widget which launches a new top level window "new_win =...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.