php ini_set函数无效怎么解决

利用ini_set可以快速的修改php.ini配置设置哦,无需打开php.ini就可以了,特别是虚拟主机时你没有修改php.ini的权限时就会发现这个函数的作用了,关于ini_set,post_max_size,upload_max_filesize,magic_quotes_gpc等用ini_set设置不了的解决办法!

  1. ini_set(‘max_execution_time’,’10′); 
  2. ini_set(‘memory_limit’,’1024M’); 
  3. echo ‘max_execution_time = ‘ . ini_get(‘max_execution_time’) . ” 
  4. “; 
  5. echo ‘memory_limit = ‘ . ini_get(‘memory_limit’) . ” 
  6. “; 
  7. echo ‘post_max_size = ‘ . ini_get(‘post_max_size’) . ” 
  8. “; 
  9. echo ‘upload_max_filesize = ‘ . ini_get(‘upload_max_filesize’) . ” 
  10. “; 
  11. ini_set(‘max_execution_time’,’10′); 
  12. ini_set(‘memory_limit’,’1024M’); 

注意:post_max_size,upload_max_filesize用下面的方法是修改不了的.

ini_set(‘post_max_size’,’1024M’);

ini_set(‘upload_max_filesize’,’1024M’);

正确做法是用.htaccess文件:

  1. php_value upload_max_filesize “80M” 
  2. php_value post_max_size “80M” 
  3. php_value max_execution_time “2000″ 
  4. php_value memory_limit “150M” 

实例设置max_execution_time,代码如下:

  1. <? 
  2.  $old_max_execution_time = ini_set('max_execution_time', 120); 
  3.    echo "old timeout is $old_max_execution_time <br />"
  4.    $max_execution_time = ini_get('max_execution_time'); 
  5.    echo "new timeout is $max_execution_time <br />"
  6.   echo 'function sets supported in this install are:<br />'
  7.   $extensions = get_loaded_extensions(); 
  8.   foreach ($extensions as $each_ext
  9.   { 
  10.     echo "$each_ext <br />"
  11.     echo '<ul>'
  12.     $ext_funcs = get_extension_funcs($each_ext); 
  13.     foreach($ext_funcs as $func
  14.     { 
  15.        echo "<li> $func </li>"
  16.     }  
  17.     echo '</ul>'
  18.   } 
  19. ?> 

补充知识点:其实在php文档里有说明upload_max_filesize的可修改范围是PHP_INI_PERDIR,PHP_INI_PERDIR的意思是域内指令可以在php.ini、httpd.conf或.htaccess文件中修改。

PHP_INI_SYSTEM 域内指令可以在php.ini和httpd.conf文件中修改,所以upload_max_filesize用int_set是无法修改的,只有可修改范围是PHP_INI_ALL的才可以用int_set修改。

magic_quotes_gpc 用 get_magic_quotes_gpc() 获得,不能用 set_magic_quotes_gpc 修改,原因是没这个函数。而magic_quotes_runtime可以用set_magic_quotes_runtime()来设置

波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!

波比源码 » php ini_set函数无效怎么解决

143 评论

  1. order avodart generic zofran 4mg sale order ondansetron 8mg

  2. sildenafil for sale brand nolvadex purchase robaxin for sale

  3. lamotrigine 200mg without prescription buy prazosin 1mg pills order tretinoin without prescription

  4. tadalafil 20mg pill cheap diclofenac order generic voltaren 50mg

  5. order cialis 5mg sale Discount viagra sildenafil tablets

  6. order benicar 20mg online cheap benicar 20mg ca buy diamox 250mg pill

  7. cost prilosec 20mg edit letter online poker

  8. buy generic sumatriptan 50mg sumatriptan pills order avodart online

  9. ranitidine 300mg for sale zantac cost celebrex oral

  10. websites to write essays stromectol 6mg us ivermectin 6mg stromectol

  11. order biaxin 500mg online catapres drug order antivert sale

  12. nifedipine drug cost aceon 8mg purchase fexofenadine online cheap

  13. order altace 10mg amaryl sale order generic etoricoxib 120mg

  14. Thank you great post. Hello Administ . Metropol Halı Karaca Halı Öztekin ve Selçuklu Halı Cami Halısı ve Cami Halıları Türkiye’nin En Büyük Cami Halısı Fabrikasıyız…

  15. prednisone 5mg sale amoxil price purchase amoxil generic

  16. ivermectin 12mg for people ed pills that work order prednisone 10mg online cheap

  17. order uroxatral 10 mg online diltiazem price diltiazem tablet

  18. order letrozole 2.5 mg online femara uk viagra 100mg brand

  19. order levothroid pills serophene cost vardenafil 10mg generic

  20. buy zantac pill cost celebrex order celecoxib for sale

  21. duloxetine side effects itching cymbalta goodrx duloxetine take with food

  22. buy accutane without prescription accutane ca order azithromycin online cheap

发表评论

Hi, 如果你对这款模板有疑问,可以跟我联系哦!

联系站长
赞助VIP 享更多特权,建议使用 QQ 登录
喜欢我嘛?喜欢就按“ctrl+D”收藏我吧!♡