Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Sep 2003
    Posts
    77

    Default Apache 2 and php5 on new server

    Currently moving a site to a new server, here is the info from CPanel:

    Operating system Linux
    Kernel version 2.6.16.29-11774_1
    Apache version 2.0.63
    PERL version 5.8.8
    PHP version 5.2.5
    MySQL version 5.0.45-community
    cPanel Build 11.18.3-RELEASE 21703
    cPanel Pro 1.0 (RC1)
    The server I used before allowed me to modify the php settings, by the use of the "php_flag" commands, however when I tried them on this new server, an error message:

    /home/username/public_html/.htaccess: Invalid command 'php_flag', perhaps mis-spelled or defined by a module not included in the server configuration
    The php settings that I have needed to change in the past are these from .htaccess:

    Code:
    php_flag session.use_trans_sid off
    php_flag register_globals off
    php_flag allow_url_fopen off
    plus forcing any php errors to a file outside of the web root (and no php errors to the browser of course). I don't think the new server uses phpsuexec , but instead: Mod SuPHP, UniqueId, Userdir, and maybe Fileprotect.

    The settings from "EasyApache" are as follows:

    Apache 2.0.63

    Access
    Actions
    Alias
    AuthnDefault
    AuthzHost
    Autoindex
    DIR
    Expires
    Fileprotect

    Prevent Users from reading other webroots

    Frontpage
    Headers
    Log Config
    Mime
    Negotiation
    Mod SuPHP

    This option will make the following changes to your profile prior to the build:
    Enables:
    CGI (PHP v4)
    CGI (PHP v5)


    Proxy
    Setenvif
    Status
    UniqueId
    Userdir
    Mod Security

    v1.9.5 for Apache 1.3, v2.1.4 for Apache 2.x This option will make the following changes to your profile prior to the build:
    Enables:
    UniqueId


    Mod Bandwidth

    v2.1 for Apache 1.3, v0.8 for Apache 2.x - see documentation that can found by clicking "More Info" for details

    Zend Optimizer for PHP

    3.3.3 - please read documentation that can found by clicking "More Info" to fully understand this option

    PHP 5.2.5

    Bcmath
    Calendar
    Curl
    CurlSSL
    FTP
    GD
    Imap
    Magic Quotes
    Mbstring
    Mcrypt
    Mhash
    Mysql

    compile mysql support against php bundled libraries (if the system mysql is checked it takes precedence of this option)

    Mysql of the system

    compile mysql (and mysqli if its checked) support against the system libraries

    MySQL "Improved" extension.

    MySQLi does not replace the standard MySQL extension. Requires MySQL 4.1 or later. !! mysqli may not work on all systems, contact your support provider for mysqli support !!

    Openssl
    Pspell
    Sockets
    TTF (FreeType)
    XSL
    XmlRPC
    Zlib

    Requires that zlib is installed and up to date
    Now for some questions please.

    1. Is there any method that I can use, to place the "php_flag" commands into .htaccess ?
    2. Is modifying php.ini the ONLY method to modify the php settings ?

    I have tried a small php.ini to override one php setting, as a test, it worked okay, however my understanding of using php.ini is .........

    (i) I will need a complete copy of the current php.ini , and then modify that
    (ii) The file php.ini then needs to be in every sub-path as well, at least every sub-path that has an include statement.

    There must be an easy way to do this, after all, don't they call it "EasyApache" ?

  2. #2
    Member
    Join Date
    Sep 2003
    Posts
    77

    Default

    Just noticed this from suPHP - FAQ ..

    Can I use the php_value directives in .htaccess files with suPHP?

    suPHP does not support the php_value/php_admin_value directive known by mod_php to parse configuration options to scripts for certain virtual hosts or directories. However there is a PECL extension named htscanner that can be used with PHP CGI (called by suPHP) to parse such options being present in .htaccess files. Be sure to take a look at the README file provided with the htscanner distribution on how to make Apache ignore the php_value directives in .htaccess files instead of throwing an error.

  3. #3
    Member
    Join Date
    Sep 2003
    Posts
    77

    Default

    Does anyone know anything about suPHP ?

  4. #4
    Member verdon's Avatar
    Join Date
    Nov 2003
    Location
    Northern Ontario, Canada
    Posts
    792

    Default

    Put a line like this in your htaccess file..
    Code:
    suPHP_ConfigPath /home/userdir
    Then create a file /home/userdir/php.ini

    Now you have a local php.ini file where you can set your directives. The syntax is a little different from what you were using in .htaccess, for example...
    php_flag register_globals off

    becomes..
    register_globals = off

  5. #5
    Member
    Join Date
    Sep 2003
    Posts
    77

    Default

    Quote Originally Posted by verdon View Post
    Then create a file /home/userdir/php.ini
    Thanks, I assume I only need to specify it once, in the .htaccess of the web root, and also that there would only need to be one php.ini , that is the one in /home/userdir/php.ini

    Peter

  6. #6
    Member verdon's Avatar
    Join Date
    Nov 2003
    Location
    Northern Ontario, Canada
    Posts
    792

    Default

    That's correct. One note of caution, doing it this way does not just add the values to your php configuration.. actually it completely negates the server-wide php.ini settings (going to some sort of built-in php default I guess) and then applies what you have in php.ini. That may not mean anything to you, but it could mean you have to put other tweaks in your own php.ini to get it back to what you had before you added your own custom php.ini. I.E. you may need to also reset things like max_upload size and error reporting.

  7. #7
    Member
    Join Date
    Sep 2003
    Posts
    77

    Default

    Okay, thanks for advising on that.

Similar Threads & Tags
Similar threads

  1. Apache 2.2 PHP5 Out of Memory
    By devourer in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 07-13-2009, 02:33 PM
  2. SuPHP+PHP5+Apache 2.0
    By bobin in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 01-22-2008, 07:52 PM
  3. How to php4 and php5 (.php5) in same server?
    By strikinado in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 06-09-2007, 12:01 PM
  4. php5 as apache module
    By _Tux_ in forum New User Questions
    Replies: 10
    Last Post: 08-25-2005, 06:54 AM
  5. PHP5 Killed Apache
    By SEAL31 in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 12-18-2004, 10:12 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube