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 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题