Why identical PHP script might work in one subdomain and not another?

后端 未结 1 916
误落风尘
误落风尘 2021-01-27 11:41

I have a php script that creates WordPress posts from a csv file (\"file.csv\") that is on the same subdomain as WordPress. This has been working for months, however, I just upl

相关标签:
1条回答
  • 2021-01-27 12:24

    Your script is probably using a lot of memory. My guest on cause whould be reading whole file to array with:

    $csv_lines  = file("file.csv");
    

    Check memory limit on each server.

    var_dump(ini_get('memory_limit'));
    

    On server that script works this value should be higher then on servers that you have your error.

    You can try to incise this value on top of your import file

    ini_set('memory_limit','256M');
    

    Or in your .htaccess file (if your server using apache)

    php_value memory_limit 256M
    

    Best solution would be to refactor your import script to lower memory consumption.

    0 讨论(0)
提交回复
热议问题