Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

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.

Custom php.ini cron jobs don´t work

Discussion in 'General Discussion' started by joaosavioli, May 5, 2017.

  1. joaosavioli

    joaosavioli Active Member

    Joined:
    Feb 7, 2008
    Messages:
    31
    Likes Received:
    8
    Trophy Points:
    58
    Hi,

    I´m trying to use a custom php.ini for cron jobs, but php ignore my php.ini and use global settings.
    user@user.com.br [~]# /opt/cpanel/ea-php56/root/usr/bin/php -c php.ini -i | grep memory_limit
    memory_limit => 256M => 256M

    user@user.com.br [~]# cat php.ini
    ; cPanel-generated php ini directives, do not edit
    ; Manual editing of this file may result in unexpected behavior.
    ; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
    ; For more information, read our documentation (PHP Home - EasyApache 4 - cPanel Documentation)

    allow_url_fopen = Off
    allow_url_include = Off
    asp_tags = Off
    display_errors = Off
    enable_dl = Off
    file_uploads = On
    max_execution_time = 90
    max_input_time = -1
    max_input_vars = 1000
    memory_limit = 512M
    session.gc_maxlifetime = 1440
    session.save_path = "/var/cpanel/php/sessions/ea-php56"
    upload_max_filesize = 10M
    always_populate_raw_post_data = -1

    I´ve tried to add in master php.ini (/opt/cpanel/ea-php56/root/etc/php.ini) these lines bellow, but I can see effect only in http.

    [PATH=/home/user]
    memory_limit = 512M;

    I´m using mod_suphp.

    Could you help me?

    Thank you.
    João
     
  2. cPJacob

    cPJacob cPanel Product Owner
    Staff Member

    Joined:
    May 2, 2014
    Messages:
    604
    Likes Received:
    94
    Trophy Points:
    103
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Hi,

    Try copying your php.ini to a .user.ini, or make the changes via the cPanel >> INI Editor UI. Doing so should write the .user.ini out and it should work after that. Please let me know how it goes!
     
  3. joaosavioli

    joaosavioli Active Member

    Joined:
    Feb 7, 2008
    Messages:
    31
    Likes Received:
    8
    Trophy Points:
    58
    Thank you for reply.

    I've tried, but didn´t work.

    user@user.com.br [~]# cat .user.ini
    ; cPanel-generated php ini directives, do not edit
    ; Manual editing of this file may result in unexpected behavior.
    ; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
    ; For more information, read our documentation (PHP Home - EasyApache 4 - cPanel Documentation)

    PHP:
    asp_tags Off
    display_errors 
    Off
    max_execution_time 
    90
    max_input_time 
    = -1
    max_input_vars 
    1000
    memory_limit 
    1024M
    session
    .gc_maxlifetime 1440
    session
    .save_path "/var/cpanel/php/sessions/ea-php56"
    upload_max_filesize 10M
    always_populate_raw_post_data 
    = -1

    /opt/cpanel/ea-php56/root/usr/bin/php -c php.ini -grep memory_limit
    memory_limit 
    => 256M => 256M

    /opt/cpanel/ea-php56/root/usr/bin/php -grep memory_limit
    memory_limit 
    => 256M => 256M

    /opt/cpanel/ea-php56/root/usr/bin/php -.user.ini -grep memory_limit
    memory_limit 
    => 256M => 256M


    Any idea
    ?

    Thank you
    Joao
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Would you mind opening a support ticket using the link in my signature so we can take a closer look at the affected system?

    Thank you.
     
  5. joaosavioli

    joaosavioli Active Member

    Joined:
    Feb 7, 2008
    Messages:
    31
    Likes Received:
    8
    Trophy Points:
    58
    Hello,

    I´ve opened a suport ticket and the problem was fixed.
    Here is the solution to help comunity:

    "Hello,

    Usually if you need to set a Custom php.ini it is better to not use MultiPHPini Editor in WHM because it will create a file that overrides PHP settings.

    # /opt/cpanel/ea-php56/root/etc/php.d/local.ini ( This file overrides custom php.ini files. )

    I've moved this file out of the way for you to test the issue a bit further. Did you have a specific cron task that you were using where the issue was experienced? CLI PHP and CGI PHP can function differently sometimes. User accounts have a wrapper enabled which should auto determine their PHP version however if you call it from the full path to PHP it may result in something different occurring as well.

    # /usr/local/bin/php ( wrapper )
    # /opt/cpanel/ea-php56/root/usr/bin/php ( full path to script )

    Calling PHP with the wrapper should automatically find the correct PHP version for this account. Curious if you were only testing with calling PHP directly or if you were actually using the PHP wrapper which is called automatically when you use command "php".

    Best Regards,

    --
    Steven V. Sublett"

    Thank you
    Joao
     
    cPanelMichael likes this.
Loading...

Share This Page