Simple definitive statement for setting up php5.3 for CLI

Hi there, I’ve been asking (noob) questions in other threads and recognise that I’m getting replies from people with much more knowledge of Linux/PHP than me…

I just need a simple answer to how I make the CLI version of PHP the same as the browser version.

I’ve seen various threads which offer some help in some of these areas

I’ve been told I “simply need to set up an alias in my bashrc” … but that’s only simple if you know what an alias or bashrc actually are (!)

Could somebody please explain, in words of one syllable what I have to do? (I am on a shared server, no VPS)

I have an application which needs to access PHP5.3 with the ZipArchive and Tidy extensions. The supplier (who isn’t exactly keen on helping me configure my server) says that his application needs to access this from “both browser and CLI”.

I have created a “.bashrc” file (currently empty) in my home/username/ folder, I have also created a “.php/5.3/phprc” file which loads the compiled extensions.

If I run a file which utilises these extensions via the browser, then it works fine.
If I run it from the CLI, PHP complains that I don’t have the correct extensions installed.

I’m baffled. I don’t speak *nix, please be gentle!

Simplest way is to run PHP as “php-5.3”, instead of just “php”. Trickier ways will depend on what you need it for exactly, and how that is running PHP.

Now, you see, you’re doing it again!

That’s only simple if you know how to “run PHP differently”. I have a black box commercial application, which I cannot change. I don’t know what you mean by “running PHP as PHP-5.3”!
My understanding of an “alias” is that it sends all requests for “PHP” to the 5.3 version, as used by the browser - if that is indeed what it does, then my guess is that’s what I need.
I need to give my commercial application an entirely normal “out of the box” PHP 5.3 with the ZipArchive and Tidy extensions. Is that not possible?



If you really do have a web application that launches the PHP CLI internally, messing around with the .bash_profile will probably not help — the PHP environment does not read any of the bash initialization files when running commands.

Without knowing a lot more about the application, I can’t really offer much advice. You may be able to get it to work by having the application set the PATH environment variable to include /usr/local/php53/bin, but I can’t give directions on how to do that, nor am I certain that it’d even work. (If the application is explicitly launching /usr/bin/php, for instance, all bets are off.)