> It's pretty easy to use PHP to update MySql server through the web sever.
Is there an easy way to use PHP scripts to update the MySql sever in a
standalone mode (without the web sever)? Any sample scripts?

You use the same scripts, but a "different" PHP.

If you are on Windows, you can do:

c:/path/to/php.exe -q c:/path/to/your/script.php

and it will run it.

On Un*x, if you compiled PHP from source, go back to the source directory
and copy "config.nice" to "config.cgi"

Then, edit "config.cgi" and take out the line that says:
--with-apxs=/path/to/your/apxs

Or, if you compiled as a static Module, the line that says:
--with-apache=/path/to/apache/source

Then, make "config.cgi" executable:
chmod +x config.cgi
and run it:
./config.cgi

It will (hopefully) produce a binary file called "php".

Last time I did this, I had to rip out some fancy stuff like GD or TTF
support or something, because I couldn't get it to compile as CGI
(stand-alone) with some things...  YMMV.

Throw that file some place convenient, like, /usr/bin and make it
world-executable:
chmod +x /usr/bin/php

Then, you can call PHP scripts from the command line a variety of ways:

#1
/usr/bin/php -q /path/to/your/script.php

#2
Add a line to the tip-top of a PHP script:
#!/usr/bin/php -q

Now, all that compiling and stuff *may* be just too geeky or tricky or
something for some people.  There is a hack (slow, inefficient, ugly) way:

You can use "wget" or "lynx --dump" from the command line to "surf" to a
page, which wastes an HTTP connection for as long as that script takes to
run.  But it works. :-)

Once you've got that working, several cool things are possible:

cron jobs, to run PHP scripts at specific time intervals.
See man cron, man crontab, and man 5 crontab

PHP shell scripts for people who consider Perl ASCII soup [like me :-)]

Web pages that do double-duty as shell scripts, if you don't mind either
very bare-bones web-site, or some <TAGS> in your shell output :-)

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to