Computer Webmaster Gaming Console Graphics Forum

Welcome to the Computer Webmaster Gaming Console Graphics Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > PHP
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help.

Google
Closed Thread
 
LinkBack Thread Tools Display Modes
Old 07-01-2007, 5:23 PM   #1
Nikolai Chuvakhin
 
Nikolai Chuvakhin's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Can I use PHP outside a HTML page ?

ffellico@inwind.it (Franco Fellico') wrote in message
news:<d8b4dc5c.0308200554.196ac7c8@posting.google. com>...
>
> I need to prepare a progam (like a demon). It must stay always
> sleeping and periodically it must watch a DB table; when it meet a
> particular condition it must send a e-mail to someone.
>
> As you understand the program need to be started in my server (where I
> have yhe MySql DB) an it don't need to be developed inside a HTML
> page.
>
> Can someone suggest me how to write it outside HTML and how I can
> start and stop it ?


First of all, you don't need a daemon to do this. A "normal" script
combined with scheduling will work just as well.

To give you a more precise recommendation, however, I need to know
three things: (1) can you run php in command line? (2) do you have
root-level control over your production server, and, if not, do
you have any other machine you control that has an "always-on"
connection to the network where your production server is? and
(3) what OS are you running on the machine you control?

Cheers,
NC
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Advertisements
Old 07-01-2007, 5:23 PM   #2
Franco Fellico'
 
Franco Fellico''s Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Can I use PHP outside a HTML page ?

Ok Nikolai. Thank you for your help.

Here are the information you need.

I will first check the program on my local LAN where I have all the
autority on my Pc's and on my Linux server (here I have only a dial-up
connection, but naturally during the tests I will be always
connected).

In the next future I would move the program on a outside unix-server
always connected to Internet (at present I have not yet a contract
with such a server) and I suppose that there I can't have root-level
control and I can't have the autority to start a program from a
command line (there I will have only space, PHP and MySQL).

So, yet I am thinking that I must start the program from here and that
in this case it's better to prepare a HTML page with PHP code inside
to start the program there (this program to be started should be the
one outside HTML page); I could see here the result of a correct start
with a message on a HTML page.

With another HTML page (again with PHP inside) should be possible to
stop the program from here and receive a confirmation message.

If you think that I am not wrong please give me some suggestion for my
needs:

- How prepare the PHP program outside a HTML page

- How to start it from a code in a HTML page

- How to stop it from a code in a HTML page

- Finally how periodically wait in PHP some time before make the work

A lot of thanks. Franco.



nc@iname.com (Nikolai Chuvakhin) wrote in message news:<32d7a63c.0308201431.41e1c6a6@posting.google. com>...
> ffellico@inwind.it (Franco Fellico') wrote in message
> news:<d8b4dc5c.0308200554.196ac7c8@posting.google. com>...
> >
> > I need to prepare a progam (like a demon). It must stay always
> > sleeping and periodically it must watch a DB table; when it meet a
> > particular condition it must send a e-mail to someone.
> >
> > As you understand the program need to be started in my server (where I
> > have yhe MySql DB) an it don't need to be developed inside a HTML
> > page.
> >
> > Can someone suggest me how to write it outside HTML and how I can
> > start and stop it ?

>
> First of all, you don't need a daemon to do this. A "normal" script
> combined with scheduling will work just as well.
>
> To give you a more precise recommendation, however, I need to know
> three things: (1) can you run php in command line? (2) do you have
> root-level control over your production server, and, if not, do
> you have any other machine you control that has an "always-on"
> connection to the network where your production server is? and
> (3) what OS are you running on the machine you control?
>
> Cheers,
> NC

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-01-2007, 5:24 PM   #3
Nikolai Chuvakhin
 
Nikolai Chuvakhin's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Can I use PHP outside a HTML page ?

ffellico@inwind.it (Franco Fellico') wrote in message
news:<d8b4dc5c.0308202130.3dc21410@posting.google. com>...
>
> In the next future I would move the program on a outside unix-server
> always connected to Internet (at present I have not yet a contract
> with such a server) and I suppose that there I can't have root-level
> control and I can't have the autority to start a program from a
> command line (there I will have only space, PHP and MySQL).


OK, so you don't have access to command line and root-level control
of your production server. If so, here is what you need to do:

1. Write the script as you normally would, without worrying about
the correct launch timing (simply assume that the timing is
correct when writing the script).

2. Place that script on your production server. Let's assume
that the script now resides at http://server.com/path/script.php

3. Now the question is, how do you schedule execution? Since
you are saying you won't have root-level access, you can't
use cron on the remote server. So you will have to use
scheduling available elsewhere. If your LAN is connected to
the Internet, you have two options:

a. If you have a Linux machine on your LAN, place a one-line
shell script (name doesn't matter) into cron.hourly, cron.daily,
or cron.weekly directory (depending on how often you want your
script run). Here is the line:

wget http://server.com/path/script.php --quiet -O /dev/null

b. If you have a Windows machine on your LAN, define a shortcut
to http://server.com/path/script.php and then use Windows
Scheduler to periodically run that shortcut.

Basically, we are trying to separate functionality from scheduling.
Functionality has to reside on the production server, but scheduling
can live anywhere... Your script will execute on the production
server, but execution will be triggered remotely by another machine.

Hope this helps.

Cheers,
NC
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-01-2007, 5:24 PM   #4
Franco Fellico'
 
Franco Fellico''s Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Can I use PHP outside a HTML page ?

Again thanks Nikolai.

I understand about everything but I am sorry because, as I said you,
my LAN it's not continuously connected to Internet so I can't schedule
the functionality from my LAN; so I will try to ask to a my friend
that have a machine always connected to do this for me.

Any way I have not clear the funcion of the statement:

wget http://server.com/path/script.php --quiet -O /dev/null

I watched "man wget" and I understand that it downolad the page, but
when the page is downloaded with this command, will be also executed
the PHP code inside it ?

Greetings. Franco



nc@iname.com (Nikolai Chuvakhin) wrote in message news:<32d7a63c.0308211349.270fbdb0@posting.google. com>...
> ffellico@inwind.it (Franco Fellico') wrote in message
> news:<d8b4dc5c.0308202130.3dc21410@posting.google. com>...
> >
> > In the next future I would move the program on a outside unix-server
> > always connected to Internet (at present I have not yet a contract
> > with such a server) and I suppose that there I can't have root-level
> > control and I can't have the autority to start a program from a
> > command line (there I will have only space, PHP and MySQL).

>
> OK, so you don't have access to command line and root-level control
> of your production server. If so, here is what you need to do:
>
> 1. Write the script as you normally would, without worrying about
> the correct launch timing (simply assume that the timing is
> correct when writing the script).
>
> 2. Place that script on your production server. Let's assume
> that the script now resides at http://server.com/path/script.php
>
> 3. Now the question is, how do you schedule execution? Since
> you are saying you won't have root-level access, you can't
> use cron on the remote server. So you will have to use
> scheduling available elsewhere. If your LAN is connected to
> the Internet, you have two options:
>
> a. If you have a Linux machine on your LAN, place a one-line
> shell script (name doesn't matter) into cron.hourly, cron.daily,
> or cron.weekly directory (depending on how often you want your
> script run). Here is the line:
>
> wget http://server.com/path/script.php --quiet -O /dev/null
>
> b. If you have a Windows machine on your LAN, define a shortcut
> to http://server.com/path/script.php and then use Windows
> Scheduler to periodically run that shortcut.
>
> Basically, we are trying to separate functionality from scheduling.
> Functionality has to reside on the production server, but scheduling
> can live anywhere... Your script will execute on the production
> server, but execution will be triggered remotely by another machine.
>
> Hope this helps.
>
> Cheers,
> NC

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-01-2007, 5:24 PM   #5
Nikolai Chuvakhin
 
Nikolai Chuvakhin's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Can I use PHP outside a HTML page ?

ffellico@inwind.it (Franco Fellico') wrote in message
news:<d8b4dc5c.0308212114.4d7a0924@posting.google. com>...
>
> I understand about everything but I am sorry because, as I said you,
> my LAN it's not continuously connected to Internet so I can't schedule
> the functionality from my LAN; so I will try to ask to a my friend
> that have a machine always connected to do this for me.


Well, you have to schedule from somewhere... It doesn't really
matter from where, as long as the scheduling machine doesn't go
offline too often.

> Any way I have not clear the funcion of the statement:
>
> wget http://server.com/path/script.php --quiet -O /dev/null
>
> I watched "man wget" and I understand that it downolad the page, but
> when the page is downloaded with this command, will be also executed
> the PHP code inside it ?


Of course. The script will be executed just as if you called
it from your browser. The "--quiet" option makes sure that wget
doesn't output anything (no one will read it anyway), and the
"-O /dev/null" option tells wget to send the results of the
script's work to /dev/null, so you don't accumulate unnecessary
HTML on your gard drive...

Cheers,
NC
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Old 07-01-2007, 5:24 PM   #6
Franco Fellico'
 
Franco Fellico''s Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default Can I use PHP outside a HTML page ?

OK NIKOLAI.
THANK YOU FOR YOUR KINDNESS. I REALIZED EVERYTHING AS YOUR
SUGGESTIONS. IT WORK OK. NOW I MUST ONLY FIND A FRIEND WITH A
PERSISTENT CONNECTION THAT COULD EXECUTE MY SCRIPT PERIODICALLY.

GREETINGS FROM GAETA IN ITALY

nc@iname.com (Nikolai Chuvakhin) wrote in message news:<32d7a63c.0308221117.1a3b8827@posting.google. com>...
> ffellico@inwind.it (Franco Fellico') wrote in message
> news:<d8b4dc5c.0308212114.4d7a0924@posting.google. com>...
> >
> > I understand about everything but I am sorry because, as I said you,
> > my LAN it's not continuously connected to Internet so I can't schedule
> > the functionality from my LAN; so I will try to ask to a my friend
> > that have a machine always connected to do this for me.

>
> Well, you have to schedule from somewhere... It doesn't really
> matter from where, as long as the scheduling machine doesn't go
> offline too often.
>
> > Any way I have not clear the funcion of the statement:
> >
> > wget http://server.com/path/script.php --quiet -O /dev/null
> >
> > I watched "man wget" and I understand that it downolad the page, but
> > when the page is downloaded with this command, will be also executed
> > the PHP code inside it ?

>
> Of course. The script will be executed just as if you called
> it from your browser. The "--quiet" option makes sure that wget
> doesn't output anything (no one will read it anyway), and the
> "-O /dev/null" option tells wget to send the results of the
> script's work to /dev/null, so you don't accumulate unnecessary
> HTML on your gard drive...
>
> Cheers,
> NC

 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Featured Websites
Free Space
Free Space
Free Space Free Space
Closed Thread
Tags: , , , ,




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I use PHP outside a HTML page ? shell PHP 0 07-01-2007 5:22 PM
Looking for a way to generate an HTML file download page... Jay Vance PHP 6 07-01-2007 3:40 PM
How to pass data to HTML page without cookies? Robert Oschler PHP 1 07-01-2007 3:37 PM
Where does PHP embedded in an HTML page execute? rush PHP 0 07-01-2007 3:37 PM
page with no .html olwen HTML 6 07-01-2007 1:57 PM


Featured Websites




All times are GMT +1. The time now is 12:27 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98