Idiots Guide to Installing PHP


Recommended Posts

If you have hosting with Dreamhost or any other host which gives you a shell account, you can install your own custom version of PHP. I needed to compile PHP with GMP support for the OpenID login plugin for WordPress, so I spent the whole day tweaking trying to get everything working. There's a page on Dreamhost's Wiki which has a script, but it still took me hours to get right. I've written a quick guide to help avoid the mistakes which slowed me down.

  1. The first thing you need to do is download Putty and set it up to connect to your host.
  2. We're going to create a few shell scripts to install PHP and all the other packages it requires. It's probably easiest to make your edits in notepad or another text editor, then copy and paste them into Putty by right-clicking. If you just create the files then upload them, there tend to be problems with line breaks and the script doesn't work.
  3. Start by downloading the preparation script and the installation script. Open them with a text edtitor and change the line export DOMAIN="yourdomainhere.com" to match the domain you're installing the CGI script on. This should be the directory the domain is served from. Eg: If your site serves files from /home/someone/xyz.com, use xyz.com. The version information may need updating, because I won't be updating this script.
  4. The first script we need to set up will download the different packages and extract them. Once you're done editing, hit CTRL+A in your text editor, then copy everything to your clipboard. Create a new file by typing nano php_prep.sh at the command prompt.
  5. Paste the contents of your clipboard into the new file by right clicking in Putty, then hit CTRL+O to save the file, then CTRL+X to exit nano.
  6. In *nix you need to make files excutable before you can run them. Do this by typing chmod +x php_prep.sh
  7. Now we need to set up the script which does the installing. Create a new file by typing nano php_inst.sh at the prompt, then copy and paste the contents of your edited php_inst.sh file by right clicking the terminal. Hit CTRL+O, Return, then CTRL+X to save and exit.
  8. Make the file executable by typing chmod +x php_inst.sh
  9. Now that everything's set up, we can run the first script by typing ./php_prep.sh at the prompt. It might take a while but if there are no errors you should eventually see "Done downloading and unpacking prerequisites".
  10. Run the installation script using ./php_inst.sh . This might take a while to complete, so start solitaire or something.
  11. When everything's finished, you should see "INSTALL COMPLETE!" and have a shiny new custom version of PHP installed.
  12. If you don't already have one, create a .htaccess file at the root of your domain. You can do this by typing nano .htaccess. Add the following lines:
    	  Options +ExecCGI
    	  AddHandler php-cgi .php
    	  Action php-cgi /cgi-bin/php.cgi


  13. That should be it. If there were no errors, you can test your installation by viewing a PHP file on your site. Hopefully you'll either see no change, but it's possible you'll see a load of errors.

I'm not an expert with Linux, but I'll try to help with any problems people may run in to.

I also posted this article on my blog, which has loads of other technical How-Tos and tutorials.

Link to comment
https://www.neowin.net/forum/topic/615690-idiots-guide-to-installing-php/
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Why should simply opening the Action Center ... require any significant amount of CPU cycles? Too many are ignoring the elephant in the room: today's CPUs may have similar clock frequencies to CPUs from a decade ago (~4 to 5 GHz), but they run with far higher performance per clock, even on the smallest E-cores. The Action Center is a static, minor desktop element. It ought to open instantly on any CPU made in the past 2.5 decades at even low clocks. Opening a program? Boost away. Unzipping a file? Boost to your heart's content. Right-clicking the notification area? This should be an ultra-efficient, low-impact event that opens instantly. Compare today's UI elements to Windows 7 UI elements. Today's UI elements hardly do anything more substantial or important or critical, yet now require modern-day processors to jump half a GHz to reduce their latency.
    • This is not an option lmao: it is part of the KB5094126 update, pushed to all users. There is no GUI to configure it. Reading the article should be required for commenting.
    • Can you recommend me a good Pixel 7 on eBay? Because some are saying Gen 1, and I don't think that's what I want, right?
    • Close, but it is for any application starting, not just during boot time. In fact, it probably will not improve boot time at all because during a boot, the CPU is already boosting, so a pre-boost wouldn't change anything. I agree that it isn't exciting (especially considering every other OS already does it), but it is a good thing, even if they are just playing catch up.
    • Any so called performance increase will be in milliseconds, which nobody will actually notice in real world usage.
  • Recent Achievements

    • One Year In
      slackerzz earned a badge
      One Year In
    • One Year In
      highriskpaym earned a badge
      One Year In
    • One Month Later
      highriskpaym earned a badge
      One Month Later
    • Week One Done
      highriskpaym earned a badge
      Week One Done
    • Week One Done
      FBSPL earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      501
    2. 2
      PsYcHoKiLLa
      198
    3. 3
      +Edouard
      156
    4. 4
      Steven P.
      84
    5. 5
      ATLien_0
      71
  • Tell a friend

    Love Neowin? Tell a friend!