A Small Orange Forums: PHP5 is now available! - A Small Orange Forums

Jump to content

  • (9 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

PHP5 is now available! Rate Topic: -----

#1 User is offline   -ASO- Tim

  • Former Head Orange
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 5,238
  • Joined: 14-March 04

Posted 16 February 2006 - 01:30 PM

Yes, finally! There's just a bit of a trick to getting it running, but it's available and running side-by-side with PHP4. By default, we're still going to use mod_php4 on all our servers as the default, but those who need or want PHP5 will have the option to do so.

How It Works

We've added PHP5 running through FastCGI. It's like a CGI, except fast, as the name implies. The short of it is that your PHP5 interpreter stays running even after the request for a page has been completed. Unlike CGI, this means you don't have to incur the expensive task of starting up PHP from scratch on every page load.

Every server has a separate copy of PHP5 installed at /usr/local/php5-fcgi/ that is compiled with FastCGI support. Just like you do with Ruby, you need a way to hook that up to execute when a .php5 file is hit. To make things easy, we've added a default configuration in Apache to all the servers that runs all .php5 files through a shell script. In reality, you can have that script do whatever you want, but ideally it will just call over to the PHP5 binary and get the party started.

Using PHP5

First, create a file in your public_html directory called php5.fcgi. If this is a subdomain put the file in the subfolder for the site instead of public_html. This script will be called whenever there is a request to a .php5 page and there are no active FastCGI PHP processes running. You will need to CHMOD this script as 755 to ensure it functions properly. In it, you'll want to put this:

CODE
#!/bin/sh
PHP_FCGI_CHILDREN=2
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=500
export PHP_FCGI_MAX_REQUESTS
exec /usr/local/php5-fcgi/bin/php


That's all there is to it. What is that script doing? Well, it sets some basic FastCGI-related environmental variables to ensure that you don't have a ton of FastCGI processes starting up and that they are killed off after 500 requests to protect against memory leaks. Please don't increase these values as they could lead to unstable operation of your server. Be a good neighbor!

Since you're free to make some changes to this script, you can also set it up to run your own php.ini file. You can change the last line to this:

exec /usr/local/php5-fcgi/bin/php -c /home/username/php.ini

That will point to a php.ini file in your home directory that you can set up with whatever options you'd like. We have used the default php.ini-dist file for the copies of PHP5 on all the servers, so you can use the file from php.net to go on. Feel free to make any configuration changes you like, but remember to consider the fact that you're on a server with other users. Do your best to disable any potential security-related settings (like register_globals) or performance-related settings (like MySQL persistent connections).

So, go and enjoy all the new features and changes that PHP5 has to offer smile.gif
Owner/Manager
A Small Orange Software
<a href="http://www.timdorr.com" target="_blank">timdorr.com</a>

Looking for quick support? <a href="https://www.asmallorange.com/help//index.php?_m=tickets&_a=submit" target="_blank">Submit a support ticket</a>
0

#2 User is offline   GrahamWilmott

  • Small Orange
  • PipPip
  • Group: Members
  • Posts: 44
  • Joined: 04-March 05

Posted 16 February 2006 - 02:07 PM

Let me be the first to say "cool"
Who let the Spammers Spam?(Spam, Spam, Spam, Spam)
0

#3 User is offline   oldcustomer

  • Very Large Orange
  • PipPipPipPipPip
  • Group: Members
  • Posts: 714
  • Joined: 21-December 05

Posted 16 February 2006 - 02:37 PM

Thanks to Tim's help in the other thread I now have it working great biggrin.gif
0

#4 User is offline   z3rb

  • Move all 'Zig'. For great justice.
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,372
  • Joined: 16-June 05

Posted 16 February 2006 - 03:49 PM

Woot!
IPB Image
0

#5 User is offline   Logan

  • Very Large Orange
  • PipPipPipPipPip
  • Group: Members
  • Posts: 482
  • Joined: 04-December 04

Posted 16 February 2006 - 06:02 PM

This is good news. I'm really happy to see PHP 5 implemented, not so impressed that it is only being implemented as Fast-cgi?

Aren't there quite a few disadvantages for using it in CGI mode? Also, is there anyway to set PHP 5 to run all .php files so what I have doesn't have to be renamed to .php5? Will you ever "eventually" be moving it over as a module and getting rid of PHP 4?

You should also update your features page to reflect the addition smile.gif http://www.asmallora...ng/features.php

This post has been edited by Logan: 16 February 2006 - 06:41 PM

0

#6 User is offline   Transverse Styles

  • Moderately Sized Orange
  • PipPipPip
  • Group: Members
  • Posts: 95
  • Joined: 10-July 05

Posted 16 February 2006 - 06:29 PM

PHP5 will eventually replace PHP4, so it's good to see it being implemented. I think that it's fine if it runs as a CGI module because it's not the default installation of PHP.

This post has been edited by Transverse Styles: 16 February 2006 - 06:29 PM

0

#7 Guest

  • Group: Guests

Posted 16 February 2006 - 08:15 PM

<3 <3 <3
0

#8 T C M @ Work

  • Group: Guests

Posted 16 February 2006 - 08:16 PM

wub.gif

No way to get this to run with all .php files, eh? This est awesome.
0

#9 User is offline   Ghoul

  • Very Large Orange
  • PipPipPipPipPip
  • Group: Members
  • Posts: 492
  • Joined: 06-February 05

Posted 16 February 2006 - 11:32 PM

In another thread, Tim said to add this into an .htaccess file:
CODE
AddType application/x-httpd-php5 .php

I just tested it and it works fine:
http://www.nocensmun...t/php5/test.php
http://www.nocensmun.../php5/test.php5

Both show PHP 5.1.2 info! biggrin.gif

This post has been edited by Ghoul: 16 February 2006 - 11:34 PM

0

#10 User is offline   Jeremy Banks

  • Customer #1647
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,567
  • Joined: 27-January 05

Posted 16 February 2006 - 11:34 PM

QUOTE(Ghoul @ Feb 16 2006, 11:32 PM) View Post

In another thread, time said to add this into an .htaccess file:
CODE
AddType application/x-httpd-php5 .php

I just tested it and it works fine:
http://www.nocensmun...t/php5/test.php
http://www.nocensmun.../php5/test.php5

Both show PHP 5.1.2 info! biggrin.gif

wub.gif wub.gif wub.gif wub.gif wub.gif wub.gif wub.gif wub.gif wub.gif

EDIT: I did that, now it prompts me to download each page.

This post has been edited by TCM: 16 February 2006 - 11:36 PM

Eh.
0

#11 User is offline   Ghoul

  • Very Large Orange
  • PipPipPipPipPip
  • Group: Members
  • Posts: 492
  • Joined: 06-February 05

Posted 16 February 2006 - 11:35 PM

QUOTE(Ghoul @ Feb 16 2006, 11:32 PM) View Post
In another thread, time said to add this into an .htaccess file:

Er.. Tim said it. Time? Time to go to bed I think!

This post has been edited by Ghoul: 16 February 2006 - 11:35 PM

0

#12 User is offline   Jeremy Banks

  • Customer #1647
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,567
  • Joined: 27-January 05

Posted 16 February 2006 - 11:43 PM

QUOTE(Ghoul @ Feb 16 2006, 11:35 PM) View Post

QUOTE(Ghoul @ Feb 16 2006, 11:32 PM) View Post
In another thread, time said to add this into an .htaccess file:

Er.. Tim said it. Time? Time to go to bed I think!

I figured that's what you meant. tongue.gif

Anyways, as I said, it's just prompting me to download all of the pages now. Unrecognized MIME type, I guess, the pages aren't being parsed. =\
Eh.
0

#13 User is offline   Ghoul

  • Very Large Orange
  • PipPipPipPipPip
  • Group: Members
  • Posts: 492
  • Joined: 06-February 05

Posted 16 February 2006 - 11:56 PM

Hrm, strange. The .php5 extension is working, yes?
0

#14 User is offline   Jeremy Banks

  • Customer #1647
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,567
  • Joined: 27-January 05

Posted 17 February 2006 - 12:15 AM

QUOTE(Ghoul @ Feb 16 2006, 11:56 PM) View Post

Hrm, strange. The .php5 extension is working, yes?

I should probably try that first, shouldn't I? >_>
Eh.
0

#15 User is offline   Ghoul

  • Very Large Orange
  • PipPipPipPipPip
  • Group: Members
  • Posts: 492
  • Joined: 06-February 05

Posted 17 February 2006 - 12:32 AM

The issues I had were because php5.fcgi was saved with Windows newlines rather than Unix newlines, so it wouldn't run.
0

#16 User is offline   Jeremy Banks

  • Customer #1647
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,567
  • Joined: 27-January 05

Posted 17 February 2006 - 01:19 AM

QUOTE(Ghoul @ Feb 17 2006, 12:32 AM) View Post

The issues I had were because php5.fcgi was saved with Windows newlines rather than Unix newlines, so it wouldn't run.

How would I fix that?

phpinfo.php4
phpinfo.php
phpinfo.php5

EDIT: I forgot to chmod, but I've still got the wrong line endings.

EDIT: I opened the file with a Hex Editor, but it showed Unix linebreaks. It still isn't working. =\

This post has been edited by TCM: 17 February 2006 - 01:33 AM

Eh.
0

#17 User is offline   -ASO- Tim

  • Former Head Orange
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 5,238
  • Joined: 14-March 04

Posted 17 February 2006 - 01:35 AM

You're on HP. I didn't put it on that machine because we're going to be decommisioning it eventually (still has a few sites to go first).
Owner/Manager
A Small Orange Software
<a href="http://www.timdorr.com" target="_blank">timdorr.com</a>

Looking for quick support? <a href="https://www.asmallorange.com/help//index.php?_m=tickets&_a=submit" target="_blank">Submit a support ticket</a>
0

#18 User is offline   Jeremy Banks

  • Customer #1647
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,567
  • Joined: 27-January 05

Posted 17 February 2006 - 01:45 AM

QUOTE
Tim' date='Feb 17 2006, 1:35 AM' post='42469']
You're on HP. I didn't put it on that machine because we're going to be decommisioning it eventually (still has a few sites to go first).

Ohhhhhhhhhhhh. That makes sense.
Eh.
0

#19 User is offline   oldcustomer

  • Very Large Orange
  • PipPipPipPipPip
  • Group: Members
  • Posts: 714
  • Joined: 21-December 05

Posted 17 February 2006 - 11:53 AM

Obviously PHP 5.1 doesn't have eaccelerator because that only supports PHP 4/5.

Is ASO planning to install some other accelerator (e.g. APC)?
0

#20 User is offline   oldcustomer

  • Very Large Orange
  • PipPipPipPipPip
  • Group: Members
  • Posts: 714
  • Joined: 21-December 05

Posted 17 February 2006 - 12:09 PM

An update. My site is crawling ATM.

I am using the default settings.

If I try using a custom php.ini then I get an error log produced that says:

CODE
PHP Warning: Unknown(); Unable to load dynamic library


Help appreciated biggrin.gif
0

  • (9 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users