Switching to PHP 5.3 / FastCGI

software development


I’m trying to switch to PHP 5.3 / FastCGI. Yesterday afternoon I toggled the setting in the control panel for the host. But << php -v >> is still returning PHP 5.2.17.

What more do I need to do? Do I need to reboot the host?


That setting only affects the web site, not the command line. If you want the command-line version of PHP 5.3, it’s at /usr/local/php53/bin/php.


In that case, how do I configure do have my scripts run under PHP 5.3?

I’ve looked at http://wiki.dreamhost.com/Installing_PHP5, and http://wiki.dreamhost.com/PHP.ini#PHP_5.3, and these suggest to me that the control panel toggle is all that is needed.


For login shell, add it to $PATH by editing .bash_profile

  • …if running externally, alter PATH in .bashrc


I’m also hoping to get 5.3.5 working on the command line.

I have /usr/local/php53/bin as the first element of my path, but a bare php --version shows 5.2.17, whereas typing the full path /usr/local/php53/bin/php --version shows version 5.3.5…

which php

What can override the path like that?


Hmm weird. Might have to wait for a response from Andrew on that.

In the meantime, something you might try is setting PATH in .bashrc and adding . .bashrc (dot space dot) or source .bashrc to .bash_profile, then logout and back in again for good measure.


I figured it out. Somehow, somewhen, an alias to the old php was added to this account’s .bash_profile. Why, I’m not sure, but that was the problem.

Thanks much!


If your usage uses a lot of memory you might want to experiment with 5.3 CGI versus 5.3 Fastcgi. Memory bound applications are running more consistently quickly with cgi at 5.3 versus Fastcgi. I think the resulting memory footprint is smaller with cgi than Fastcgi. The home page on one of my Wordpress sites was worst case loading at 22 seconds with Fastcgi, with cgi it’s now worst case about 4 seconds.