The PHP command line interface or CLI allows you to run PHP scripts from the command line. It also has a number of flags that can be passed to it which allow you to see which modules are available, do a syntax check on a file, view PHP information etc. This post gives a basic list of the command line arguments available for the PHP CLI and in later posts I will look at some ...
February 1st, 2012 | Posted in How to, Knowledge | No Comments
I've been doing a reasonable amount of PHP CLI (command line interface) programming recently for getting stuff from log files and converting large numbers of images. Some of these processes can some quite a while to run, sometimes as long as several hours, so it can be useful to know roughly how far through the process it is. This post looks at how to output a counter to the command line from PHP which replaces ...
February 1st, 2012 | Posted in How to | No Comments
As well as running PHP scripts via a web server such as Apache, you can also run PHP scripts from the command line (it's also possible to write GUI apps with PHP using PHP-GTK, but I'll maybe look at that another time). This post looks at the two ways you can run a PHP script from a *nix based computer (Linux, UNIX, BSD, OSX) and the single way you can do it from Windows.
Using a ...
February 1st, 2012 | Posted in Hosting Tutorial, How to, Knowledge | No Comments
On Mac servers I love the advent of a neat feature called Time Machine. Time Machine does incremental backups without having to deal with 3rd-party software, or custom shell scripts like the one I'm about to show. Unfortunately, on the Linux side there's always some degree of elbow grease that's required. Which isn't to say you couldn't have Time Machine-like backups on Linux, you certainly can, it just takes a more concentrated technical effort, ...
February 1st, 2012 | Posted in PHP script | No Comments
Just wanted to share a script that I worked on, that is doing it's job. I am sure that this can be done many other ways. However this is doing the job just fine. In my particular script we have a couple servers that sometimes the load goes super high and actually renders the server useless. This is caused by a php script. Developers are still looking into the memory ...
February 1st, 2012 | Posted in How to | No Comments
How could I output the shell scripted output with PHP to a web browser?
The script runs for 2 minutes and prints out several lines during the execution of the script on the command line.
Need a way to run this with PHP and print the output of the shell script as the script executes instead of all at once when the script has completed execution.
I have looked at all the docs for this type of Shell Command Execution. ...
February 1st, 2012 | Posted in PHP script | No Comments
If you want to run php script in shell, simply put the following line at the beginning of your php file.
#!/path/to/php
#!/path/to/php is the path you installed php in linux. If you don’t know where php is installed in your linux. Type the following command
which php
This will output the php path from your linux. The output will be something like this
1
/usr/bin/php
For example: hello.php
1
#!/usr/bin/php
2
<?php
3
echo "What ever you want to show!";
4
?>
Make your php script executable by typing
chmod ...
February 1st, 2012 | Posted in PHP script | No Comments