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.

Using FastCGI + special php.ini directives for a Directory

Discussion in 'Workarounds and Optimization' started by PedroR, Jul 4, 2011.

  1. PedroR

    PedroR Registered

    Jan 12, 2011
    Likes Received:
    Trophy Points:
    Hi all

    We're running suPHP and are experience performance issues with suPHP not scaling well when load raises above a certain level.

    Therefore, we considered changing from suPHP to FastCGI.

    However the different applications we have sometimes require that we override the global php.ini directives with specific ones in a special directory/application.

    We have for example:
    - a legacy app that needs register_globals on
    - an app that produces PDFs and needs maximum_memory set to 100M

    With suPHP : we would just put a php.ini file in the directory with the configurations we wanted to override and everything works fine.

    With fastCGI : this approach does not seem to work. We can't even set different php.ini configurations per account.
    With fastCGI enabled it seems to only read and respect the global php.ini

    What I wanted to ask is if there is any way to have a different php.ini file on specific directories.

    I have come across this info but I am unsure how it will co-exist with Cpanel:
    ( from mod_fcgid - Apache HTTP Server )
    PHP wrapper script - /usr/local/bin/php-wrapper
    # Set desired PHP_FCGI_* environment variables.
    # Example:
    # PHP FastCGI processes exit after 500 requests by default.
    # Replace with the path to your FastCGI-enabled PHP executable
    exec /usr/local/bin/php-cgi
    In my case, we don't want to override PHP_FCGI_MAX_REQUESTS but would like to use
    /usr/local/bin/php-cgi -c "custom php.ini for this folder and subfolders" or -d "setting=abc" instead of -c

    Is this possible and will it work in a Cpanel configuration?

    In Cpanel it seems FastCGI is configured and enabled globally through WHM...

    Thank you very much and Best Regards
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Oct 2, 2010
    Likes Received:
    Trophy Points:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator

Share This Page