doumanju2533 2019-06-24 12:12
浏览 81
已采纳

如何访问php.ini文件

I need to change some variables in the php.ini file to be able to upload files. I bought a domain & hosting, and i access it through FileZilla. Usisng phpinfo() I know

Configuration File (php.ini) Path is /usr/local/php/p56

Loaded Configuration File is /usr/local/directadmin/data/users/kristak/php/funwithhakase.pl/php56.ini

I don't know which of these files should I access and how to change the desired variables. I tried putting the adresses into FileZilla, but nothing appeared. Pls help :)

  • 写回答

2条回答 默认 最新

  • dongyun8891 2019-06-24 12:32
    关注

    First - you should see your hosting documentation regarding specific access / permissions. You also did not mentioned what control panel you are using ( whm, cpanel, plesk , virtualmin, custom )

    As for runtime :

    You can use ini_set in order to change some of the runtime variables.

    It might not be available with your hosting, but you can always try ( most hosting that I have encountered allow it to some degree )

    Likewise, you can use ini_get to see current values, for example to know what is the upload_max_filesize that is currently used :

    echo 'upload_max_filesize = ' . ini_get('upload_max_filesize') . "";
    

    and to set it :

    ini_set('upload_max_filesize','1024M');
    

    or with error suppression :

    @ini_set('upload_max_filesize',$my_Value);
    

    Depending on your hosting, you could potentially do that with most variables of the ini file :

    ini_set('max_execution_time','10');
    ini_set('memory_limit','1024M');
    ini_set('post_max_size','1024M');
    

    Another way ( again - hosting permitting ) is to use .htaccess

    Syntax is a bit different

    php_value upload_max_filesize "80M"
    php_value post_max_size "80M"
    php_value max_execution_time "2000"
    php_value memory_limit "150M"
    

    Under some hosting that permit - you can actually put per-folder user.ini \ .user.ini or php.ini \ .php.ini with the values you want to override - but again, best is to consult hosting documentation.

    If you want to make sure to know where is the used ini you can also try

    <?php echo php_ini_loaded_file(); ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分