php-general | 2001062
Date: 06/27/01
- Next message: Richard Lynch: "Re: [PHP] shared object not open"
- Previous message: Richard Lynch: "Re: [PHP] Fetching binaires from an e-mail"
- In reply to: Zhu George-CZZ010: "[PHP] a standalone PHP script to update MySql server"
- Next in thread: Brian Paulson: "[PHP] APXS -S option in 4.0.6"
- Reply: Brian Paulson: "[PHP] APXS -S option in 4.0.6"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> 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 richard <email protected> address is an endangered species -- Use ceo <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: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Richard Lynch: "Re: [PHP] shared object not open"
- Previous message: Richard Lynch: "Re: [PHP] Fetching binaires from an e-mail"
- In reply to: Zhu George-CZZ010: "[PHP] a standalone PHP script to update MySql server"
- Next in thread: Brian Paulson: "[PHP] APXS -S option in 4.0.6"
- Reply: Brian Paulson: "[PHP] APXS -S option in 4.0.6"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

