The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

enabling mod_rewrite module in http.conf

Discussion in 'General Discussion' started by runee, Jul 1, 2009.

  1. runee

    runee Registered

    Joined:
    Jul 1, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hello everybody,

    I am new to this forum. I want to enable mod_rewrite module since I want to add few of the codes in the .htaccess file that is used in uploading images with more than 2 MB.

    I am having problems in uploading images with more than 2 MB. I also tried to use custom php.ini file. I also tried to use .htaccess file. .htaccess file works well locally but when I tried to use it in this server it generates an error and I cannot browse any of the pages.

    I can easily connect to the SSH using PUTTY. I want to enable mod_rewrite so that it supports .htaccess codes.

    Please help me on this.

    how can I make this work.

    Thanks a lot.
     
  2. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0
    Runee:

    It sounds like that what you are doing isn't mod_rewrite commands as you claim
    but rather you are really trying to change the PHP upload limit using your .HTACCESS.

    Unfortunately, using "php_flag" and "php_value" commands to override
    configuration values in PHP only work on those servers where PHP has been installed
    as an insecure Apache DSO module (Usually running as the generic user "nobody").

    (This configuration is not recommended because of major security issues)

    Dropping in a new custom PHP.INI file into your account home only works
    to override PHP configuration settings if the PHP on the server has been
    configured to operate as a CGI directly or as the obsolete and now rarely
    used configuration mode called phpSuEXEC which was one of the legacy
    methods used in the days before SuPHP came along to run scripts as the
    account owner instead of user "nobody" but it had it's own set of problems.

    Those server which are properly configured today, are now mostly all running
    SuPHP which is structured as a special DSO module which in turn calls the
    PHP CGI binary and executes the user PHP scripts under the owner username
    and unlike the previous two styles of PHP, SuPHP doesn't have either of the
    major security issues or inherent problems found in the earlier PHP installations.
    Likewise, the methods of setting up the configuration commands are also different
    as well and configuration override commands can still be setup but most be setup
    in one of the following forms when the server is running PHP as SuPHP:

    1. Editing the main server PHP.INI file (usually in /usr/local/lib)

    2. Overriding the PHP settings in the virtualhost container in
    the main httpd.conf file (located in /usr/local/apache/conf)

    3. Creating a custom PHP.INI file located in /usr/local/lib/php.ini.d
    or in a location specified by the server administrator using the
    a "suPHP_ConfigPath" directive in httpd.conf for your account.

    4. Some, but not all, directives can also be changed from within
    your PHP scripts using the set_ini() command unless the server
    administrator has restricted this function with disable_functions().

    One significant difference between SuPHP based PHP and the others
    is that end users CANNOT override server PHP settings unless explicitly
    allowed for by the server administrator and the server administrator
    retains control as to who can and cannot update PHP settings which
    is a significant improvement over the other legacy methods of installing
    PHP which allowed for the end user to edit too many settings


    The statement you made tells me that the server you are using has PHP installed as SuPHP
    and attempting to add commands to your .HTACCESS file will just cause your web site to
    generate an error 500 condition and block your web site from working.

    Since your server is clearly running the newer SuPHP instead of the old phpSuExec,
    this would be the reason why dropping in a custom php.ini file did not work for you either
    as this is not permitted under SuPHP unless explicitely setup by the server administrator.

    To make the PHP settings changes you requested, you will need to have the limits raised
    for PHP uploads either increased server wide across the whole server (OR) use one of
    the valid methods of changing the settings I mentioned previously earlier in this post which
    does not involve editing the .HTACCESS file or dropping in custom PHP.INI files unless you
    have been setup by the server administrator permission to be able to do that.

    .
     
    #2 Spiral, Jul 1, 2009
    Last edited: Jul 1, 2009
  3. runee

    runee Registered

    Joined:
    Jul 1, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    http.conf

    Hello Spiral,

    Thanks for your prompt reply.

    1. Editing the main PHP.INI file (usually in /usr/local/lib)
    I tried this first one but it didnt allowed me to save the php.ini file after editing

    2. Overriding the PHP settings in the virtualhost container in
    the main httpd.conf file (located in /usr/local/apache/conf)
    I didnt find the apache folder under the local directory. where can I find this.

    3. Creating a custom PHP.INI file located in /usr/local/lib/php.ini.d
    or in a location specified by the server administrator using the
    a "suPHP_ConfigPath" directive in httpd.conf for your account.

    waiting for your reply
    thanks
     
  4. Spiral

    Spiral BANNED

    Joined:
    Jun 24, 2005
    Messages:
    2,023
    Likes Received:
    7
    Trophy Points:
    0

    You have to be logged in via SSH to your server as the "root" administrator
    in order to be able to edit and save the primary PHP.INI file for the server.

    If you do not have "root" access then you cannot update this file
    and you will need to contact your server administrator to help you!

    Otherwise, don't forget to restart your apache server process after
    updating the PHP.INI file using the command 'service httpd restart'
    after you finish making the changes to your configuration.

    It sounds like you are not logged in as "root" or are logged in using a restricted jailshell.

    You must be logged in as "root" in order to edit any server wide configuration files.

    An alias (symlink) folder for /usr/local/apache on most Cpanel servers is /etc/httpd

    To create a custom PHP.INI file setup for a specific hosting account on your
    server instead of making changes for the entire server globally, you will need to
    create a copy of the PHP.INI file found in /usr/local/lib saved to a new PHP.INI
    file stored at some other new location and then add the suPHP_ConfigPath directive
    the the VirtualHost section of HTTPD.CONF for the account where you want
    the custom changes to appear and tell the server where you saved your new
    custom PHP.INI so it can be used with the account where you want the changes.

    (Click to see suPHP - Documentation for more information on updating SuPHP settings)

    If you do not have access as "root" then you will need to contact your
    server administrator and request assistance making these changes.

    Without root access, you may still be able to change some options using
    the ini_set() function from within your PHP scripts directly but you would
    be limited in what settings you could change.
     
    #4 Spiral, Jul 1, 2009
    Last edited: Jul 1, 2009
  5. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,481
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    mod_rewite should be enabled by default on your server. If not, rebuilding apache should take care of that.

    You can edit the server's PHP Configuration from within WHM.

    If you don't have root access to do either of these you'll need to speak to your host.
     
Loading...

Share This Page