473,246 Members | 1,703 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,246 software developers and data experts.

How can I run php scripts from a shell script?

Newbie about this stuff.

I want to run some php scripts from a shell script(bash?)

the php script i want to run is this:
test.php

and it's path is this:
home/virtual/blahblah.com/home/abc/mainwebsite_html/bluhbluh/dbtest/

1. How would I creat the shell script?
2. How would I execute it?

I have already tried ot figure it out with no success.

I have php 4.2.2

Thanks

Jul 17 '05 #1
2 2067
jo**@munsey.net spilled the following:
Newbie about this stuff.

I want to run some php scripts from a shell script(bash?)

the php script i want to run is this:
test.php

and it's path is this:
home/virtual/blahblah.com/home/abc/mainwebsite_html/bluhbluh/dbtest/

1. How would I creat the shell script?
2. How would I execute it?

I have already tried ot figure it out with no success.

I have php 4.2.2


PHP can be compiled as a standalone binary or as a module for various
webservers. The former can also be used in conjunction with a webserver.
Life's a lot simpler if you have the standalone binary. I use SuSE mostly -
it's mod_php rpm includes both the module and standalone interpreter. If
you have got it on your machine it'll probably be called 'php' and is
likely to be in /usr/bin or /usr/local/bin. First thing to try would be
`which php` - then try looking in the directories for something named *php*

Then it's just a matter of running the interpreter with the script as the
first argument. e.g.

php /home/virtual/blahblah.com/home/abc/mainwebsite_html/bluhbluh/dbtest/test.php

although you may not want extraneous html in your output so....

php -q test.php
Just in case you can't find it, and can't install your own, you can fetch a
web page from the comand line using a variety of tools - most boxes will
have wget and/or curl.

HTH

C.
Jul 17 '05 #2
you can also set the script up like a normal shell script in the form
of...

-- start file --
#!/usr/local/bin/php -q
<?

/* php code here */

?>
-- end file --

the path to php can be take the form of

/usr/local/bin/php
/usr/bin/env php
/usr/bin/which php

etc.
they should all work out fine.

Good luck!

Jul 17 '05 #3

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

Similar topics

2
by: eichin | last post by:
One of my recent projects has involved taking an accretion of sh and perl scripts and "doing them right" - making them modular, improving the error reporting, making it easier to add even more...
9
by: Jeff Wagner | last post by:
I have a project of converting numerous DOS cmd shell scripts to Python. Is there a tutorial to getting started? Thanks, Jeff
2
by: RJ | last post by:
We currently send product releases to our customers, and often have to include scripts that need to be ran on the Oracle databases (also do it for SqlServer customers, but we use a different set of...
8
by: Jan Danielsson | last post by:
Hello all, How do I make a python script actually a _python_ in unix:ish environments? I know about adding: #!/bin/sh ..as the first row in a shell script, but when I installed python on...
1
by: sandercaerteling | last post by:
Hi There! I created a few python scripts and everything is working fine. But to make it easier to run the procedure i want to couple these scripts in one big script. Is there a possibility to do...
0
by: paulhjwu | last post by:
Hi, I have problems running a couple of shell scripts from PHP. I found a similar posting, so I posted my question to the original author. But unfortunately the original author is not at the...
24
by: Mark | last post by:
Hi, I'm new to python and looking for a better idiom to use for the manner I have been organising my python scripts. I've googled all over the place about this but found absolutely nothing. I'm...
1
by: sainathr | last post by:
Hi, I would like to run shell scripts with respect to the time mentioned in postgres data base tables. Postgres database should trigger the shell script for the time mentioned in the table. To...
9
by: Catherine Moroney | last post by:
I have one script (Match1) that calls a Fortran executable as a sub-process, and I want to write another script (Match4) that spawns off several instances of Match1 in parallel and then waits...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.