Go Back   HostGator Peer Support Forums > HostGator Peer Support Forums > Shared Hosting Support

Notices

Reply
 
Thread Tools
  #1  
Old 01-14-2011, 12:07 AM
GatorJacob's Avatar
GatorJacob GatorJacob is offline
HostGator Staff
 
Join Date: Apr 2008
Location: Houston
Posts: 7,294
Default PHP 5.3 Support

Hello,

We currently offer PHP 5.3 support on our shared servers as an addition with PHP 5.2. In order to utilize PHP 5.3 on your domain, place the following code inside the document roots .htaccess file:

Code:
Action application/x-hg-php53 /cgi-sys/php53
AddType application/x-httpd-php53 .php

Thanks Richard for the below information:
Quote:
CAUTION: For those who use the cPanel "QuickConfig" feature, it should be noted that it works by putting a php.ini copy into the /home/username/ folder and setting the suPHP_ConfigPath in your primary .htaccess file to point to that copy.

Because the "QuickConfig" php.ini copy is originally based on the php.ini file that is installed as part of the server's setup for its default PHP version, there may be serious problems if the user subsequently decides to use some other PHP version. The php.ini copy pointed to by the suPHP_ConfigPath that "QuickConfig" sets may contain configuration paths, extensions and other settings that are not suitable for a PHP version that is chosen thereafter. It may even be missing some settings required by the newer version entirely.

As just one of many examples of problems that can thus arise, the PHP 5.3 option discussed by GatorJacob as the topic of this thread differs from PHP 5.2 in the server path that is used for its extension modules --
PHP 5.2: extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613"
PHP 5.3: extension_dir = "/opt/php53/lib/php/extensions/no-debug-non-zts-20090626"

So, if you've used cPanel's "QuickConfig" to set up or modify your PHP configuration, get rid of its php.ini copy and the suPHP_ConfigPath pointer to it that "QuickConfig" puts in your primary .htaccess file before implementing any PHP version change!
Here is a generic fix for the TZ issue

PHP Code:
Code:
// Force PHP 5.3.0+ to take time zone information from OS
if (version_compare(phpversion(), '5.3.0', '>='))
{
    @date_default_timezone_set(date_default_timezone_get());
}
Please do let us know if you see any problems
__________________
Jacob P
HostGator.com
Systems Monitoring Supervisor


Last edited by GatorJacob; 04-28-2011 at 05:54 PM.
Reply With Quote
  #2  
Old 01-14-2011, 07:32 PM
alice alice is offline
Baby Croc
 
Join Date: Dec 2010
Posts: 79
Default Re: PHP 5.3 Support

***I Posted another post before I saw this. Below is an error that I see.***

There is a well know bug in PHP 5.3 that causes errors when using TimeZone functions. When I tested 5.3 a few minutes ago I got this error. The errors will look roughly like this:
PHP Warning: PHP Startup: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Calcutta' for 'IST/5.0/no DST' instead in Unknown on line 0

The PHP.ini file needs to have the following entry:

In the PHP.ini:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = America/Chicago
Reply With Quote
  #3  
Old 01-15-2011, 02:48 PM
alice alice is offline
Baby Croc
 
Join Date: Dec 2010
Posts: 79
Default Re: PHP 5.3 Support

In ".htaccess" I added the following per instructions:
Action application/x-hg-php53 /cgi-sys/php53
AddType application/x-hg-php53 .php

5.3 was confirmed running.

In one of my modules I had the following date code to display date:

<?php echo date("F j, Y, g:i a"); ?>

After 5.3 change I started receiving the following errors:

strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.

After researching the error I added the following entry to my .htaccess that allows me to point to my own php.ini file (I placed a tested 5.3 php.ini file in the directory):

suPHP_ConfigPath /home/myname/php

The php.ini file included this entry:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "America/Chicago"

***Error continued.

Finally, I added this line of code in the module that contains the erroring date function:

<?php date_default_timezone_set('America/Chicago'); ?>

***PROBLEM SOLVED!

I thought I would leave this here in case someone else encounters the same problem (and they will).
Reply With Quote
  #4  
Old 01-16-2011, 09:16 PM
virtvir5's Avatar
virtvir5 virtvir5 is offline
King Croc
 
Join Date: Feb 2009
Location: Parry Sound, Canada
Posts: 1,245
Default Re: PHP 5.3 Support

CAUTION: For those who use the cPanel "QuickConfig" feature, it should be noted that it works by putting a php.ini copy into the /home/username/ folder and setting the suPHP_ConfigPath in your primary .htaccess file to point to that copy.

Because the "QuickConfig" php.ini copy is originally based on the php.ini file that is installed as part of the server's setup for its default PHP version, there may be serious problems if the user subsequently decides to use some other PHP version. The php.ini copy pointed to by the suPHP_ConfigPath that "QuickConfig" sets may contain configuration paths, extensions and other settings that are not suitable for a PHP version that is chosen thereafter. It may even be missing some settings required by the newer version entirely.

As just one of many examples of problems that can thus arise, the PHP 5.3 option discussed by GatorJacob as the topic of this thread differs from PHP 5.2 in the server path that is used for its extension modules --
PHP 5.2: extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613"
PHP 5.3: extension_dir = "/opt/php53/lib/php/extensions/no-debug-non-zts-20090626"

So, if you've used cPanel's "QuickConfig" to set up or modify your PHP configuration, get rid of its php.ini copy and the suPHP_ConfigPath pointer to it that "QuickConfig" puts in your primary .htaccess file before implementing any PHP version change!
__________________
Regards, Richard
VIRtech.org
Reply With Quote
  #5  
Old 01-17-2011, 02:23 PM
alice alice is offline
Baby Croc
 
Join Date: Dec 2010
Posts: 79
Default Re: PHP 5.3 Support

Quote:
Originally Posted by virtvir5 View Post
CAUTION: For those who use the cPanel "QuickConfig" feature, it should be noted that it works by putting a php.ini copy into the /home/username/ folder and setting the suPHP_ConfigPath in your primary .htaccess file to point to that copy.

Because the "QuickConfig" php.ini copy is originally based on the php.ini file that is installed as part of the server's setup for its default PHP version, there may be serious problems if the user subsequently decides to use some other PHP version. The php.ini copy pointed to by the suPHP_ConfigPath that "QuickConfig" sets may contain configuration paths, extensions and other settings that are not suitable for a PHP version that is chosen thereafter. It may even be missing some settings required by the newer version entirely.

As just one of many examples of problems that can thus arise, the PHP 5.3 option discussed by GatorJacob as the topic of this thread differs from PHP 5.2 in the server path that is used for its extension modules --
PHP 5.2: extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613"
PHP 5.3: extension_dir = "/opt/php53/lib/php/extensions/no-debug-non-zts-20090626"

So, if you've used cPanel's "QuickConfig" to set up or modify your PHP configuration, get rid of its php.ini copy and the suPHP_ConfigPath pointer to it that "QuickConfig" puts in your primary .htaccess file before implementing any PHP version change!
Richard, Thanks for posting this explanation for problems relating to the use of PHP 5.3. I encountered this problem and we worked through it until my problems were resolved.

This is certainly a problem when using any form of the 'date ()' functions.

Thanks again...Alice
Reply With Quote
  #6  
Old 01-17-2011, 03:21 PM
virtvir5's Avatar
virtvir5 virtvir5 is offline
King Croc
 
Join Date: Feb 2009
Location: Parry Sound, Canada
Posts: 1,245
Default Re: PHP 5.3 Support

You're both welcome, Jacob and Alice.

Yes, that was almost certainly the source of your problem, Alice. The shared server php.ini defaults for PHP 5.2 (copied by "QuickConfig") include no setting at all for date.timezone as required by PHP 5.3 to avoid the problem that you saw.

I believe that HG has since included a date.timezone setting in their shared servers' php.ini for PHP 5.3, but that doesn't help if a user's php.ini has already been set up by cPanel's "QuickConfig" based on the original default PHP 5.2 configuration.

HG could avoid that particular problem by adding a default date.timezone to their servers' original PHP 5.2 set-up also, but that alone wouldn't solve all the other many differences between the php.ini-production reqirements for the two versions. As with many other such site mangement issues, individual understanding of the actual configuration process is and must remain the best answer.

Just gotta love cPanel's marvellous "Site Hosting Management" toys ... NOT! And yes, I know I'm a cynic.
__________________
Regards, Richard
VIRtech.org
Reply With Quote
  #7  
Old 04-06-2011, 06:21 PM
CypherOz CypherOz is offline
Hatchling Croc
 
Join Date: May 2010
Posts: 10
Default Re: PHP 5.3 Support

Here is a generic fix for the TZ issue

PHP Code:
// Force PHP 5.3.0+ to take time zone information from OS
if (version_compare(phpversion(), '5.3.0''>='))
{
    @
date_default_timezone_set(date_default_timezone_get());

Reply With Quote
  #8  
Old 04-06-2011, 06:29 PM
GatorJacob's Avatar
GatorJacob GatorJacob is offline
HostGator Staff
 
Join Date: Apr 2008
Location: Houston
Posts: 7,294
Default Re: PHP 5.3 Support

Thanks Cypher! I hope you don't mind that I added it to the first post
__________________
Jacob P
HostGator.com
Systems Monitoring Supervisor

Reply With Quote
  #9  
Old 04-10-2011, 06:15 PM
CypherOz CypherOz is offline
Hatchling Croc
 
Join Date: May 2010
Posts: 10
Default Re: PHP 5.3 Support

Quote:
Originally Posted by GatorJacob View Post
Thanks Cypher! I hope you don't mind that I added it to the first post
No problems!
That code should be very early in you php execution, typically in your init/bootstrap require_once code.

I've noticed that when using PHP 5.4 via the .htaccess hack it needs two processes to run per page hit...

Code:
/bin/bash php53 
/opt/php53/bin/php-cgi
Does this affect the 25 process limit?

When will 5.3 become the default and 5.2 as an option (or dropped) on shared servers?
given that PHP 5.2 is officially unsupported by php.net

Thanks!

Last edited by CypherOz; 04-10-2011 at 06:17 PM.
Reply With Quote
  #10  
Old 04-10-2011, 07:25 PM
CypherOz CypherOz is offline
Hatchling Croc
 
Join Date: May 2010
Posts: 10
Default Re: PHP 5.3 Support

A couple of other PHP 5.3 clues...

The ereg (regex) functions are deprecated in preference for the preg (PCRE) functions.
See: http://docstore.mik.ua/orelly/webprog/pcook/ch13_02.htm

1. Change the ereg matching string to have delimiters and use the PCRE preg functions:

Eg:
PHP Code:
$schema ereg_replace(",\n$"''$schema); 
becomes:
PHP Code:
$schema preg_replace("/,\n$/"''$schema); 
Another example:
PHP Code:
ereg('pattern''string'); 
becomes:
PHP Code:
preg_match('/pattern/''string'); 


2. Change split() to either explode() [faster] or preg_split() for regex splits.

Eg a simple split:
PHP Code:
$str split("\n",$my_text); 
becomes:
PHP Code:
$str explode("\n",$my_text); 
And a PCRE example:
PHP Code:
$pieces split('[[:space:]]+'$search_str); 
becomes:
PHP Code:
$pieces preg_split('/[[:space:]]+/'$search_str); 

Last edited by CypherOz; 04-10-2011 at 07:34 PM.
Reply With Quote
  #11  
Old 06-10-2011, 09:13 AM
HalbrookTech HalbrookTech is offline
Junior Croc
 
Join Date: Feb 2009
Posts: 167
Default Re: PHP 5.3 Support

So, ran in to some issues related to date.timezone, Quick Config and Zikula 1.3.0-beta3 which requires 5.3.2.

I set php 5.3.2 in the .htaccess, and the installer runs, so that's working, but the installer checks date.timezone, and it's NOT set for 5.3.2 by default, so used quick config to setup a local php.ini and the installer now reports that PDO extensions are not loaded. That means the custom php.ini is missing SOMETHING, but what? Oh, and the date.timezone settings aren't in the PHP.ini either.
Reply With Quote
  #12  
Old 06-10-2011, 09:35 AM
HalbrookTech HalbrookTech is offline
Junior Croc
 
Join Date: Feb 2009
Posts: 167
Default Re: PHP 5.3 Support

Okay, so an update to the issue. I searched on the error I was getting, it tells me what needs to be added to the php.ini, but the lines are in there, and when i make the php.ini just
Quote:
magic_quotes_gpc = Off
extension=pdo.so
extension=pdo_mysql.so
date.timezone = "America/Chicago"
It loads fine, and all those lines are in the local php.ini, in the case of the date.timezone, manually inserted. Gonna start commenting out lines until the error goes away, but seems strange to me that this is happening.
Reply With Quote
  #13  
Old 06-11-2011, 04:20 PM
HalbrookTech HalbrookTech is offline
Junior Croc
 
Join Date: Feb 2009
Posts: 167
Default Re: PHP 5.3 Support

Found another gotcha that will affect any resellers using WHMCS, need to change the ioncube loader in the custom php.ini to use the 5.3 loader instead of the 5.2 loader, otherwise WHMCS doesn't work right.
Reply With Quote
  #14  
Old 10-13-2011, 02:48 PM
scottie scottie is offline
Hatchling Croc
 
Join Date: Aug 2010
Posts: 3
Default Re: PHP 5.3 Support

Hi. I added the two lines to .htaccess to enable 5.3 and got the following error messages with one of my scripts:

Warning: include(Mail.php) [function.include]: failed to open stream: No such file or directory in ...
Warning: include(Mail/mime.php) [function.include]: failed to open stream: No such file or directory in ...

How can I include Pear Mail in PHP 5.3? Thanks!
Reply With Quote
  #15  
Old 11-30-2011, 09:14 PM
roman2 roman2 is offline
Hatchling Croc
 
Join Date: Jun 2010
Posts: 12
Default Re: PHP 5.3 Support

Hi,

I've made changes to my .htaccess file and got PHP 5.3 working. However, PDO extensions aren't loaded. What else do I need to do to have this resolved?

Can there be a document in the knowledge base and a post on this forum with a complete set of instructions on how to quickly and easily activate PHP 5.3 fully, without having to roam through forums or involving the support serivice? I imagine this would be in the interests of HostGator too (via saving on support service).

Last edited by roman2; 11-30-2011 at 09:23 PM.
Reply With Quote
  #16  
Old 11-30-2011, 11:53 PM
GatorGPineda's Avatar
GatorGPineda GatorGPineda is offline
HostGator Staff
 
Join Date: May 2009
Posts: 4
Default Re: PHP 5.3 Support

If PDO extensions are not loading please check and make sure that you do not have a custom php.ini that might be being loaded. If you do, most likely the extension settings for it are going to be for php 5.2.17 which is the default in our servers. This would cause PHP extensions for 5.3 not to load as the extension_dir is not the same. If there are no custom php.ini that might be interfering please open a support ticket with us as this would indicate a server side issue with the php 5.3 installation.
__________________
Level II Support Administrator
Hostgator.com LLC
Reply With Quote
  #17  
Old 12-02-2011, 06:54 PM
roman2 roman2 is offline
Hatchling Croc
 
Join Date: Jun 2010
Posts: 12
Default Re: PHP 5.3 Support

I spent about 2 hours with two chat support people trying to have this resolved. The second one was more responsible and committed to fixing it. It's turned that I had a php.ini above public_html, and it was affecting all of my domains. (I needed to use PHP 5.3 only on one of my add-on domains.)

He moved it inside public_html and placed a new php.ini to my add-on domain, and things started to work as expected. However, having read your reply to me here, I renamed the new php.ini and verified that it's not needed.

You know, spending 2 hours on something basic like this is excessive. I would like HG to train its support personnel in a way that would allow support people to resolve things like this within 5 minutes.

Last edited by roman2; 12-03-2011 at 03:44 PM.
Reply With Quote
  #18  
Old 12-06-2011, 09:25 PM
roman2 roman2 is offline
Hatchling Croc
 
Join Date: Jun 2010
Posts: 12
Default Re: PHP 5.3 Support

The imagick extension doesn't seem to be enabled in PHP 5.3. Is that an omission on the admins' side or do I have to do something special in order to enable it? (We have it enabled in PHP 5.2.17.)

Using a shared server.

UPDATE: got this resolved by contacting the support service.

Last edited by roman2; 12-08-2011 at 02:17 AM.
Reply With Quote
  #19  
Old 04-13-2012, 01:21 PM
Dusan Zervan's Avatar
Dusan Zervan Dusan Zervan is offline
Hatchling Croc
 
Join Date: Oct 2007
Location: Slovakia, EU
Posts: 43
Default Re: PHP 5.3 Support

Do I understand well that it is not possible to use own php.ini (using suPHP_ConfigPath) now with PHP 5.3? When will you change PHP version to 5.3 (or 5.4) by default?
Reply With Quote
  #20  
Old 04-13-2012, 01:50 PM
Dusan Zervan's Avatar
Dusan Zervan Dusan Zervan is offline
Hatchling Croc
 
Join Date: Oct 2007
Location: Slovakia, EU
Posts: 43
Default Re: PHP 5.3 Support

Quote:
Originally Posted by Dusan Zervan View Post
Do I understand well that it is not possible to use own php.ini (using suPHP_ConfigPath) now with PHP 5.3?
It seems it is working, but it is necessary to use /opt/php53/lib/php.ini as base (and make modifications).
Reply With Quote
  #21  
Old 04-21-2012, 05:01 AM
virtvir5's Avatar
virtvir5 virtvir5 is offline
King Croc
 
Join Date: Feb 2009
Location: Parry Sound, Canada
Posts: 1,245
Default Re: PHP 5.3 Support

Jacob: When I wrote my cautionary note (below) that you included in your own instructions on configuring the suPHP set-up for using the PHP v5.3 option, I was quite sure that I understood the underlying methodology. Has any of it changed recently?

HostGator's TOS Monitoring techies are now complaining about my own php.ini set-up and its "associated database" -- whatever that means -- causing excess usage problems on Gator734. I don't see it myself (see attached cpu usage record) but I do suspect some possible malicious intrusions recently. Your comments would be much appreciated.




Quote:
Originally Posted by virtvir5 View Post
CAUTION: For those who use the cPanel "QuickConfig" feature, it should be noted that it works by putting a php.ini copy into the /home/username/ folder and setting the suPHP_ConfigPath in your primary .htaccess file to point to that copy.

Because the "QuickConfig" php.ini copy is originally based on the php.ini file that is installed as part of the server's setup for its default PHP version, there may be serious problems if the user subsequently decides to use some other PHP version. The php.ini copy pointed to by the suPHP_ConfigPath that "QuickConfig" sets may contain configuration paths, extensions and other settings that are not suitable for a PHP version that is chosen thereafter. It may even be missing some settings required by the newer version entirely.

As just one of many examples of problems that can thus arise, the PHP 5.3 option discussed by GatorJacob as the topic of this thread differs from PHP 5.2 in the server path that is used for its extension modules --
PHP 5.2: extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613"
PHP 5.3: extension_dir = "/opt/php53/lib/php/extensions/no-debug-non-zts-20090626"

So, if you've used cPanel's "QuickConfig" to set up or modify your PHP configuration, get rid of its php.ini copy and the suPHP_ConfigPath pointer to it that "QuickConfig" puts in your primary .htaccess file before implementing any PHP version change!
Attached Images
File Type: jpg cpu_usage.jpg (11.2 KB, 11 views)
__________________
Regards, Richard
VIRtech.org
Reply With Quote
  #22  
Old 04-22-2012, 06:14 PM
virtvir5's Avatar
virtvir5 virtvir5 is offline
King Croc
 
Join Date: Feb 2009
Location: Parry Sound, Canada
Posts: 1,245
Default Re: PHP 5.3 Support

P.S: Just in case anyone left at HG still gives a damn about such things, somebody (HG? Google?) has screwed up the CPU Usage view graph utility on the Gator734 server’s cPanel. It was working yesterday when I used it to attach my CPU Usage image attachment to the preceeding post. Now it's not. The javascript error is as follows:
Code:
Message: Every row given must be either null or an array.
Line: 53
Char: 63
Code: 0
URI: https://www.google.com/uds/api/visualization/1.0/4da66c523f1d12b8ccaa094c46341418/format+en,default,corechart.I.js
__________________
Regards, Richard
VIRtech.org
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Does PHP have support for sqlite? tinyme Shared Hosting Support 2 01-05-2009 02:09 PM
PHP 5 and GMP Support? kherrera3 Shared Hosting Support 0 03-26-2008 06:00 PM
please remove php support Parsifal Shared Hosting Support 5 03-19-2008 05:35 PM
PHP 5 Support ShadowLink64 Shared Hosting Support 4 10-22-2006 08:18 PM
Support not responding to php problem sonic Shared Hosting Support 6 11-11-2004 02:27 AM

All times are GMT -5. The time now is 10:02 PM.