Talk:PHP

From DreamHost
Jump to: navigation, search

Custom PHP.ini files & Moving from PHP 5.3 to PHP 5.4

If you are currently using PHP5.3 with a custom php.ini and noticed that 5.4 is available on your server and want to switch:

  • Make a new directory inside the .php directory names 5.4. The path should be as follows: username/.php/5.4.
  • Copy your existing php.ini file in the username/.php/5.3 directory
  • Clean up any global variable* errors your old code balked at you and broke your scripts for including!
  • Enjoy the added benefits of 5.4.

Custom php.ini files are not supported by Dreamhost staff. So use a customize php.ini file at your own risk. If everything breaks, try turning that off first (by renaming the file).

*In PHP 5.4 the ability to registering globals has been completely removed for security reasons. (I had 1 old method of about 50 that used the global variable $_POST, & at last it breaking told me that 5.4 was indeed working. It took me less than 2 minutes to fix and upload the fix and a few minutes to test it, and my site worked as before.)

PHP4 vs PHP5?

I'm improving the article on Domains Control Panel, and I have to describe a checkbox where users can select PHP5 over PHP4. I'd love to point to some article that gave guidance on how to make that choice. For now, I'm pointing to this PHP article. It would be great if someone who has the expertise could add a section here that gave the guidance, or a pointer to an existing URL with the guidance. JimDeLaHunt 00:18, 17 Mar 2006 (PST)

So now that it's past 8/26/08 and there is no switch in the Domains Control Panel to select between PHP4 and PHP5, what is the preferred method (besides hacking my scripts to use /usr/local/php5/bin/php) for getting my scripts to use PHP5 instead of PHP4? I'm afraid my wiki-fu has not yielded any solutions, unless I just missed it. --Eugenemah 16:43, 20 October 2008 (UTC)

PHP as an Apache Module

I'm trying to install and test an application that wants PHP as an Apache Module. I know that there are lots of good reasons to run PHP as CGI, and I strongly prefer to work that way myself, but before I scrap this program or persue making it work on PHP as CGI, I want to see if it even does what I need as expected.

It looks like it is no longer an option to run PHP as an Apache Module on Dreamhost. Is that the case? (and where is the "right" place to ask this question???

Yes, that's the case. You can currently still run PHP as an Apache Module, but you cannot select it in the panel. See End of PHP as an Apache Module for info.

PHP info site

I've removed the various links to the php.dreamhosters.com subdomain from this page. Due to the ability to self-install PHP or create custom PHP.ini files, PHP can vary from domain to domain. It would seem, therefore, that generic PHP info pages are not particularly useful. Additionally, the use of promo codes (and links to a promo code site) give the impression that the subdomain was created more for personal enrichment that for providing helpful information. -- Scjessey 09:48, 8 May 2007 (PDT)

Just as an aside to this, the ability to create your own phpinfo page is covered in the article itself. -- Scjessey 09:50, 8 May 2007 (PDT)

Php4?

I tried to run a shell script

[temple]$ chmod +x install.php [temple]$ ./install.php Sorry! This version of MediaWiki requires PHP 5; you are running 4.4.9.

If you are sure you already have PHP 5 installed, it may be installed in a different path from PHP 4. Check with your system administrator.

I thought php 4 wasn't on dreamhost anymore? I've only been a member since 2006, shouldn't mine already be php5?


mod_php to PHP-CGI (Common Problems and Solutions)

For security reasons, DreamHost's default is to run PHP as CGI (PHP-CGI), as opposed to as an Apache module (mod_php). For more info, look here and here.

session_start, open failed, .htaccess, ForceType

The following error is caused by your .htaccess file.

Warning: session_start() [function.session-start]: open(/tmp/sess_smgrp3s27vegipr3g04u4adpa2, O_RDWR) failed: 
Permission denied (13) in /home/.charlie/.../.../foo on line 2

By default, DreamHost runs PHP as CGI - therefore it is running as your user (not the Apache HTTP server user "dhapache"). However, in your .htaccess file, you are forcing mod_php, which means that PHP is running as the Apache user (dhapache).

Your .htaccess file contains the following:

<Files foo>
ForceType application/x-httpd-php
</Files>

Therefore, dhapache can't access the file below:

-rw------- 1 yourusername pg123456 188 2009-07-19 12:37 /tmp/sess_smgrp3s27vegipr3g04u4adpa2

To resolve this issue, change

ForceType application/x-httpd-php

to

ForceType php5-cgi