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.

Advice on php_flag AddHandler and Action

Discussion in 'General Discussion' started by icemarkuk, Jun 27, 2005.

  1. icemarkuk

    icemarkuk Registered

    Joined:
    Jun 27, 2005
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    I'm having some config issues with a new web host. Web Host version info at the end of the post...

    I have settings in my .htaccess to turn on compression in php, I then setup a handler to compress standard .txt .htm .html files.

    # turn on PHP compression
    php_flag zlib.output_compression on
    php_value zlib.output_compression_level 1
    php_value zlib.output_handler ob_gzhandler

    # turn on compress for text based files
    AddHandler compress .html
    AddHandler compress .htm
    AddHandler compress .txt
    Action compress /compress/compress.php

    Firstly, the php_flag generates an error in the error log, and tries to show a 500 page.

    [Mon Jun 27 14:54:48 2005] [alert] [client 62.49.188.139] /home/icemark/public_html/.htaccess: Invalid command 'php_flag', perhaps mis-spelled or defined by a module not included in the server configuration

    Reading up on this suggests that my host does not have AllowOverride option set to allow me to do this, but they have told me that it is set to 'ALL'.

    Secondly, if I remove the php_value commands, then the .htaccess works. THe handlers get set up, at least I can see them in CPanel as if I'd added them there, however, the Action command appears not to work.

    My webhost does not appear to know what the problem is and have suggested that it is something to do with CPanel or PHP - any help on this would be massively appreciated.

    One interesting aside; the CPanel does not show the same PHP version that php_info() does. Cpanel shows 4.3.11 but php_info show 5.04 which is the version that my host tells me is installed.

    **** Version Info *****


    Apache version 1.3.33 (Unix)
    MySQL version 4.1.11-standard
    PHP version 5.04
    PERL version 5.8.4
    Kernel version 2.4.21-32.0.1.ELsmp
    cPanel version 10.2.0-RELEASE-82
    cPanel Pro Version 1.0 (RC2)

    php info:
    Configure Command './configure' '--prefix=/usr' '--with-xml' '--enable-bcmath' '--enable-calendar' '--with-curl' '--with-dom' '--with-dom-xslt' '--with-dom-exslt' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr' '--with-xpm-dir=/usr/X11R6' '--with-gettext' '--with-imap' '--with-imap-ssl' '--with-kerberos' '--with-mcrypt' '--enable-magic-quotes' '--with-mysql' '--enable-discard-path' '--with-pear' '--with-pspell' '--enable-sockets' '--enable-track-vars' '--with-ttf' '--with-freetype-dir=/usr' '--enable-gd-native-ttf' '--enable-versioning' '--with-xmlrpc' '--with-zlib'
    Server API CGI
    Virtual Directory Support disabled
    PHP API 20031224
    PHP Extension 20041030
    Zend Extension 220040412
    Debug Build no
    Thread Safety disabled
    IPv6 Support enabled
    Registered PHP Streams php, file, http, ftp, compress.zlib
    Registered Stream Socket Transports tcp, udp, unix
     
  2. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    16
    Location:
    arkansas
    cPanel Access Level:
    Root Administrator
    put the php directivies inside of a php.ini in the /home/username folder

    It sounds like they have phpsuexec installed and you can not use php directivies inside of the .htaccess file
     
  3. icemarkuk

    icemarkuk Registered

    Joined:
    Jun 27, 2005
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Thanks. you are correct about the phpsuexec, they told me about that later today.

    I tried the php.ini with no joy... the Action command is not working ( the resultant compress.php should just outputs "Hello" instead of the page ) but the page is being loaded as normal. And php output is not getting compressed.

    I put the php.ini in my lowest level directory and in my public_html directory, but to no affect. Could php.ini processing be turned off, or is there any way of being sure it is being processed?
     
  4. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    16
    Location:
    arkansas
    cPanel Access Level:
    Root Administrator
    make a page with just <? phpinfo() ?> on it and then view it through the web browser and see if php is picking up any of the directivies inside the php.ini

    also paste your php.ini that your putting in the directory
     
  5. icemarkuk

    icemarkuk Registered

    Joined:
    Jun 27, 2005
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Nothing is being picked up.

    Here is my php.ini - I just moved my stuff across from the htaccess, because that's all I read to do from other places.


    # turn on PHP compression
    php_flag zlib.output_compression on
    php_value zlib.output_compression_level 1
    php_value zlib.output_handler ob_gzhandler

    # turn on compress for text based files
    AddHandler compress .html
    AddHandler compress .htm
    AddHandler compress .txt
    Action compress /compress/compress.php
     
  6. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    16
    Location:
    arkansas
    cPanel Access Level:
    Root Administrator
    http://us2.php.net/zlib .

    here is a url that explains the syntax to add those commands to a php.ini

    as in
    zlib.output_compression = On
     
Loading...

Share This Page