Talk:Installing PHP5

From DreamHost
Jump to: navigation, search

I cleaned up the old discussion, since all errors were bug-fixed. If there are any bugs or wishes just post it here. Maybe I find some time to fix the script or to make new features available.

cleaned up again. --B0ther 01:59, 22 Apr 2006 (PDT)


  • Some times the script aborts the copy and right click in console (like putty) instead of the 'installscript'-file way. Workaround: just look what's the last successful action and replay it.
  • It's not a Bug, it's a feature! Linebreaks introduces a new command (if the last line doesn't end with an "\").
  • I receive an error when the installation is working on the openssl extension regarding SSLv2; I believe SSLv3 is installed on the server.
    /php5.5-source/php-5.5.13/ext/openssl/xp_ssl.c:363: undefined reference to `SSLv2_server_method'
    /php5.5-source/php-5.5.13/ext/openssl/xp_ssl.c:338: undefined reference to `SSLv2_client_method'
  • SSL3 was removed on all DreamHost servers late last week so that's no longer an issue.

Wish List

  • Freetype support (don't know if it's really needed since the option '--enable-gd-native-ttf' is set)
  • MSSQL installation - how to compile FreeTDS into this whole thing and I guess also remove MySQL/MySQLi


  • more interactive
  • PEAR installer
  • fastcgi support


  • When installing php 5.2.0 I was getting a few errors like this: "curl/interface.c:372: error: `CURLOPT_FTPASCII' undeclared (first use in this function)" and found that I needed to change the curl version to 7.14.0 from 7.16.0 that was there, as per a comment on this site!.html not sure why or if the script should be updated...
    • I got the same error, though it is supposedly fixed in the 5.2 CVS branch. Suggest using 7.14.0 until that fix is in a release version of PHP.
  • DreamHost killed my installscript mid-install (excessive processor usage, perhaps?). --Antiver 15:45, 29 Nov 2006 (PST)
  • Why is --without-pear enabled? I removed that line from the script and PEAR installed fine. Then using the ~/php5/bin/pear command installs the PEAR modules to the right place within the new environment. I added include_path = ".:/home/oc_horde/php5/lib/php" to ~/php5/etc/php5/domain/php.ini and PEAR seems cosher. Brousch 13:31, 9 Oct 2006 (PDT)
  • The install script could prepend the htaccess lines via unix shell commands, as well, I'm fairly sure.
    • yes. but maybe the user has created a htacces him/her-self. any ideas instead? It will make me happy automate as much as possible! --B0ther 09:26, 9 Apr 2006 (PDT)
    • I'd create it as "etc/htaccess" in the install directory -- then users can copy or append it wherever they want. Dagolden 04:43, 5 May 2006 (PDT)
  • Getting the following error upon following the instructions exactly:
    You don't have permission to access /cgi-bin/php.cgi on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. "
    This is the third time I've tried this. I was told by Dreamhost support that it's my fault, but even with a blank PHP file, it gives me the error. Please help.
    • maybe you have to chmod the file php.cgi yourself. Normaly it works in the way we do in the sript! try this: "chmod 0755 cgi-bin/php.cgi" with a terminal in the directory of your domain. Another problem is if you try to do a symlink to the php executable. This doesn't work (i don't knwo why) --B0ther 01:59, 22 Apr 2006 (PDT)
    • I ran into the same thing and solved it by adding "Options ExecCGI" to my .htaccess file
  • I ran the install script, and it seems everyting went just fine, but i had this suspicion that the changes i made to php.ini (upload_max_filesize, upload_tmp_dir, and max_execution_time, max_input_time, memory_limit) werent taking. I couldnt upload a 10 MB file via php (much less a 120MB file). So i decided to introduce errors into php ini, rename it, and otherwise test my installation... i dont think that the changes are being utilized. Can anyone advise?
    • I'm having the same problem -- with the script as it is currently, PHP appears not to be reading the php5/etc/php5/domain/php.ini file at all, even though a phpinfo() says it is (and points to the correct path). Changes to the php.ini file don't appear to make any difference to the observed configuration options that phpinfo() shows. I'm at somewhat of a loss. Any suggestions? --Coandco 13:59, 3 Jul 2006 (PDT)
    • Found the problem, and the solution. For some reason, PHP can't locate php.ini with the current install script, even when pointed to it with a configure option. The solution to this is to add the line SetEnv "PHPRC /home/username/php5/etc/php5/" to your .htaccess. This will give PHP an alternate means of locating its configuration file. --Coandco 08:36, 9 Aug 2006 (PDT)
    • Coando's solution did not work for me, so I created an alternate solution which worked for me. From the command prompt: ln -s ${INSTALLDIR}/etc/php5/php.ini ${INSTALLDIR}/etc/php5/${DOMAIN}/php.ini Brousch 06:39, 19 Oct 2006 (PDT)
  • I just ran the installscript from the default SSH directory, and am having problems. First, my CGI bin is in a folder called YOURDOMAIN, which means something must have gotten confused along the way. Further, any PHP scripts that attempt to run return this error, "Not Found The requested URL /cgi-bin/php.cgi/revisited/index.php was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request." My problems have been documented on the DH forum here. flccorg 10:24, 12 Oct 2006 (PDT)
  • is there anyway to get freetyp2 to work with php5? I've tried compiling my own freetype and integrating it with php5, but everytime I run phpinfo, it isn't installed --Breasor 09:49, 24 Oct 2006 (PDT)
  • Not sure if it's a bug, but I keep getting this error towards the end of the installation:
    Installing PDO headers: /home/******/php5/include/php/ext/pdo/
    rm: cannot lstat `.' in `.': Stale NFS file handle
    • FIXED - One of the last lines had "rm -fr" instead of "rm -rf"
      • why is this an error? rm -fr is just the same as rm -rf... usually, the options that take no further arguments can be put in any order you like... --Baby 15:13, 4 September 2007 (PDT)
  • Not sure if this could/should be added to the wiki page, but because this is such a long process to go through, what I did was use the "screen" command to start a temporary shell. There are plenty of tutorials on the full usage of screen (this is one), but what I did is this:
    • Created and chmodded the install script(s) (depending on which version you're using)
    • Entered command: screen
    • Started install script
    • At this point, you can finish the install normally, and type exit to get back to your original shell
    • If your SSH connection gets closed or disconnected, after you reconnect, type: screen -DD -r (screen -r will probably work just as well unless screen hasn't noticed you're gone)
    • If you want to let the script run and work on other stuff, type Ctrl+a and then Ctrl+d. You will be at your original shell prompt, but screen and your compile are still running! Reattach when desired with command: screen -r (You can even disconnect the entire SSH connection (the compile will keep running!), reconnect later, and use screen -r to get back to the compilation!)

Screen can do a lot more than this but this is very handy for long-running processes especially if your SSH connection is not stable. I don't use wikis much, so if there's a better way to compile these steps into something useful as part of the instructions in this article, I'll leave that to someone else; that's why I'm just mentioning this on the discussion page for now. --DavidSzp 07:56, 20 December 2007 (PST)

Necessary updates to script

Please feel free to update the script here PHP5_installscript.

for multiple domains

To install for more than one domain just duplicate ~/php5/etc/{} and maybe the php.cgi (or can you just use the one, and refer to it from other .htaccess -- which is the other thing: you need to put those addhandler and action statements in each domain's .htaccess). Hmm... does this make sense? It does work... :-) Samwilson 22:49, 19 Oct 2006 (PDT)

Configuring for: PHP Api Version: 20020918 Zend Module Api No: 20020429 Zend Extension Api No: 20050606 Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script.

With this script alone, I'm getting this error message on cerritos. Naturally, I emailed support. They told me that they don't support custom scripts. How nice. Before server cerritos was moved to new hardware, the script worked without fail. Now on the new machine, it fails. I told support this in an email. They didn't care. They won't even support the conditions of possibility that allow the user to put a custom script on.


I had the exact same problem. The procedure I took was to download the autoconf source and compile it to a local directory. Then there was a problem with the phpize script, which I will detail the fix for at a later date.

CMS Related comment moved here from Article for follow-up

CMS Users: Understand that Dreamhost uses MySql, and not MySqli. When you compile PHP5, you must not install mysqli, as the PHP5 script will default to that instead of MySql. The CMS will work as long as you use the Dreamhost default PHP5 installation. (Edited for accuracy, as I just figured out what I did wrong.) Xyber411 Thanks to: Rlparker for keeping the comments alive.

Actually, the Dreamhost provided (pre-compiled) versions of PHP (running as cgi) behave differently from one another. Dreamhost's PHP4 does not include support for MySqli, while their PHP5 does. If you are running mod_php on Dreamhost, you will be using a PHP4 version without MySqli support. Whether a given PHP5 script uses MySQL or MySqli to make database calls is entirely dependent upon how it is coded and/or how the application is configured.
Some CMS applications, that can work with either MySQL or MySQLi, let you select either way, ususally indicated by a variable in the configuration file or section of the main script. I don't think it is accurate to make a general statement such as "When you compile PHP5, you must not install mysqli, as the PHP5 script will default to that instead of MySql." because the truth of that statement is completely dependent upon the script in question. While that may be true for a script that tests for the availability of MySQLi and uses it if it is available, it is not true for scripts that are coded (or configured) to use MySQL irrespective of whether or not MySQLi support is available. My thinking would be you should generally install MySQLi support, so you will have it available if you need it; of course, if you are sure you *wont* need it, then you may feel differently about that.
The statement, "The CMS will work as long as you use the Dreamhost default PHP5 installation," is particularly confusing in light of your preceeding counsel to *not* install MySQLi when compiling PHP5 becuause the "default" PHP5 on Dreamhost *does have* MySQLi installed. In one statement you advise *not* to include MySQLi, while in the next statement you affirm that "the CMS" will work if MySQLi is installed. I'm wondering which/what CMS you are talking about in the context of this issue, as I suspect that it probably behaves the way you describe because of a configuration or coding method. Once it's behavior is clearly understood, then we will know better what is happening with *that CMS*, and I think that is better than making a "questionable" statement about the general behavior of scripts for "CMS users". It might well be that this entry would more properly belong on a page about that particular CMS (maybe linked from here)? Rlparker 10:37, 12 Dec 2006 (PST)
Wow, thanks for all the information. At this point, I suppose I should just let you in on the situation I have been involved in. You see, I was attempting to use Drupal ([1]) as a base site for a mailing list. I do not like the mailing lists provided by Dreamhost, as interfacing with them from a website seems more difficult than I'm capable at the moment (seeing as my understanding here is obviously so limited, but you're helping a lot... Thanks again, by the way). Anyways, I got my mind around using one of their modules, the mailhandler module. That requires imap support, which Dreamhost does not support out of the box. So, I emailed DH and they sent me here to compile my own version of PHP5, which I did (after about 20 failed attempts due to seemingly random errors). So, when I compiled it as per instructions with all features as written, without any errors, and added it to my .htaccess, I found that the login function broke. So, I switched the .htaccess file back until I could do some research. I came across a blog which stated that they had to change their settings.php file to read mysqli:// from mysql://, so I figured I'd give it a shot, and it worked. Suddenly the site came back to life. After I had all this working though, I found that the module listhandler is not a mailing list at all, but simply an extension to the mailhandler module. I really wish people would learn to more accurately title things (myself notwithstanding). I am now attempting to use the Organic Groups module with it's Organic Groups List Manager module. It now seems I'm going to have some trouble with this as well, but that's for another wiki guru. So, what's all of this for? The Nintendo Wii. I'm trying to get things as simple for the users as possible. The path things will go are as follows: They send an invite email to -> mailhandler -> listhandler -> forums -> Organic Groups -> Organic Groups List Manager -> users inboxes. By doing this, they send one email and it gets sent to everyone, as well as gets posted to the forums. I will also have a filter which will filter out anything which is not directly from a Wii console. I'm also trying to split off of the mailhandler to also create a new user account based off of the Wii Console Number, but that's going to take me quite some time, I'm sure. --Xyber411 21:18, 12 Dec 2006 (PST) This was moved here from a user talk page to keep discussion together in a single place Rlparker 05:27, 13 Dec 2006 (PST)
I think I understand better some of the background now, which makes me feel even more strongly that this "CMS users: Understand.." Section does not belong in this article. The situation you are describing is a very specific implementation concern that is not particularly related to the process of installing PHP5. It is also true that the paragraph is not accurate. That "blog post" you ran across may or may not have had anything to do with the environment here at Dreamhost; the writer there was detailing *his* experience and the Dreamhost environment is (very) likely to be different than his. You wrapped a lot of different issues into this last comment, none of which really have anything to do with the installation of PHP5. Certainly there are Drupal installation issues involved, and other site functionality concerns (mail handling, etc); I just don't think the discussion belongs on "Installing PHP5". Since this wiki is intended to be a documentary resource for Dreamhost users, I suggest you might consider bringing up these kinds of issues in the Dreamhost Discussion Forum, where I think they are more appropriately discussed. You are likely to receive greater input on the myraid of issues you are dealing with in that forum, and it will relieve the wikignomes from refactoring your writing for relevancy. If you really want to use the wiki to sort these issues, I suggest moving this whole discussion to your own user page, or your own Talk page, as it is no longer relevant to the article in question (certainly "parts" of this might be appropriate on the Drupal Talk page). If you should decide to do that, I have no objection to you moving my comments also to maintain continuity of discussion ;-). Other editors are likely to delete this section anytime, as it is not really relevant *here* :-) Rlparker 05:27, 13 Dec 2006 (PST)
Thank you for all the help and information. I believe I now have a better understanding of what exactly a wiki is and is meant to do. I will definately move it to that forum you refrenced, and I will try to keep the wiki about resolutions only, and no specifics. I would like to ask if there is a wiki dreamhost drupal area? I believe the if there is, then the users there would benefit from the resolutions I may post. I'll search for that as well and see if I can post it there too. Thanks for being so understanding. :D Any chance you know how to make Dreamhost use mysql instead of mysqli using my current PHP Installation? Or should I recompile with different features enabled? --Xyber411 12:20, 13 Dec 2006 (PST)

Dreamhost PHP5 Implementation

Can someone please edit the code from the article to match the dreamhost implementation of PHP5? I am having issues with the custom build, and I'm completely unsure what's changed between my PHP5 install and dreamhost's PHP5 install.--Xyber411 06:19, 16 Dec 2006 (PST)

New Stuff Added

Hey guys i moved this to the discussion page for sake of cleanness.

  • New: Added --enable memory limit as the reason that most want to compile their is because they want to change the memory limit in php.ini
  • New: Added Freetype support to GD. GD is usless for dynamic text without Freetype.
  • New: Added troubleshooting for shells other then Bash
  • New: Fixed lltdl issue
  • New: Full XML and SOAP support
  • New: Fixed some packages url
  • New: Fixed (cd $LIBICONF is error, cd ../$LIBICONF is right)
  • Missing: a way to choose what features to install
  • still Missing: pear-installer
  • New: Updated PHP to 5.2.0, LIBXML2 to 2.6.27, LIBXSLT to 1.1.18, cURL to 7.16.0, LIBIDN to 0.6.8 and updated download URLs for LIBXSLT and LIBXML2. Also added commands to remove source and distribution directories before and after install starts. Still trying to figure out how to get the newest version of IMAP to work (2006e or something).
  • New: Reverted cURL to 7.14.0 since 7.16.0 did not work.

Reverting to previous version?

Is there any way to back out after following the install instructions? It's totally killed my page (error 500) and none of the suggestions for fixing it seem to work.--BobZ 22:59, 11 May 2007 (PDT)

Remove the code from your .htaccess file. —Emufarmers 02:18, 12 May 2007 (PDT)
Hooray, my page is back. Thanks! --BobZ 20:46, 24 May 2007 (PDT)

Implementing FastCGI w/ Install

For those that would like to run FastCGI along with their custom PHP5 installation, the following steps worked perfectly for me. Sorry if they aren't as detailed as they could be. I haven't tested this on a PHP4 install, but I don't see why it wouldn't work with paths changed accordingly.

  • Shell into your account.
  • Create the FCGI wrapper with the following command
vim ~/
  • Hit i to enter insert mode, then right click to paste the following lines, replacing USERNAME and YOURDOMAIN.COM as necessary
export PHPRC=/home/USERNAME/php5/etc/php5/YOURDOMAIN.COM
exec /home/USERNAME/YOURDOMAIN.COM/cgi-bin/php.cgi
  • Hit ESC to leave insert mode, then type :wq and hit return to apply your changes.
  • CHMOD the dispatch file
chmod u+x ~/
  • Replace the .htaccess information you added when installing your custom PHP with the following (Back up your existing .htaccess in case anything goes wrong) :
AddHandler fastcgi-script fcg fcgi fpl
AddHandler php5-fastcgi .php
Action php5-fastcgi /cgi-bin/dispatch.fcgi
Options +ExecCGI

And that should be it. Hope this helps for those wanting to get APC or other FCGI-required plugins to work. --Discomatt 13:57, 11 December 2007 (PST)

Credit to PHP FastCGI for the original tutorial.

PHP 5.3 + Xdebug + APC Returning Error 1

/home/navarrb/CPHP/php5/lib/libc-client.a(osdep.o): In function `ssl_onceonlyinit':
/home/navarrb/CPHP/source/imap-2004g/c-client/osdep.c:300: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
ext/standard/dns.o: In function `php_parserr':
/home/navarrb/CPHP/source/php-5.3.1/ext/standard/dns.c:418: undefined reference to `__dn_expand'
/home/navarrb/CPHP/source/php-5.3.1/ext/standard/dns.c:468: undefined reference to `__dn_expand'
/home/navarrb/CPHP/source/php-5.3.1/ext/standard/dns.c:652: undefined reference to `__dn_expand'
/home/navarrb/CPHP/source/php-5.3.1/ext/standard/dns.c:674: undefined reference to `__dn_expand'
/home/navarrb/CPHP/source/php-5.3.1/ext/standard/dns.c:513: undefined reference to `__dn_expand'
ext/standard/dns.o:/home/navarrb/CPHP/source/php-5.3.1/ext/standard/dns.c:519: more undefined references to `__dn_expand' follow
ext/standard/dns.o: In function `zif_dns_check_record':
/home/navarrb/CPHP/source/php-5.3.1/ext/standard/dns.c:393: undefined reference to `__res_nsearch'
ext/standard/dns.o: In function `zif_dns_get_mx':
/home/navarrb/CPHP/source/php-5.3.1/ext/standard/dns.c:933: undefined reference to `__res_nsearch'
/home/navarrb/CPHP/source/php-5.3.1/ext/standard/dns.c:944: undefined reference to `__dn_skipname'
/home/navarrb/CPHP/source/php-5.3.1/ext/standard/dns.c:951: undefined reference to `__dn_skipname'
/home/navarrb/CPHP/source/php-5.3.1/ext/standard/dns.c:964: undefined reference to `__dn_expand'
ext/standard/dns.o: In function `zif_dns_get_record':
/home/navarrb/CPHP/source/php-5.3.1/ext/standard/dns.c:810: undefined reference to `__res_nsearch'
/home/navarrb/CPHP/source/php-5.3.1/ext/standard/dns.c:833: undefined reference to `__dn_skipname'
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1

is what I get. Anyone know how to fix?

Yes just execute this command:

export EXTRA_LIBS="-lresolv"

before compiling PHP, you could put that line in the script provided from the wiki. -Ratius 19:45, 27 Dec 2009