LAMP-php配置最佳化

來源:互聯網
上載者:User

標籤:php

1、/usr/local/php7/etc/php.ini是php的設定檔

[[email protected] ~]# /usr/local/php7/bin/php -i | grep -i ‘loaded configuration file‘Loaded Configuration File => /usr/local/php7/etc/php.ini

2、禁用不安全的功能

[[email protected] ~]# cat /usr/local/php7/etc/php.ini |grep disable_functionsdisable_functions =eval,assert,popen,passthru,escapeshellarg,escapeshellcmd,passthru,exec,system,chroot,scandir,chgrp,chown,escapeshellcmd,escapeshellarg,shell_exec,proc_get_status,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,leak,popepassthru,stream_socket_server,popen,proc_open,proc_close,phpinfo##如果禁用eval函數,就算可以上傳php檔案也是不能執行的。##禁用phpinfo防止網站php資訊泄露。

3、錯誤資訊處理

[[email protected] ~]# vi /usr/local/php7/etc/php.inidisplay_errors = Off                   ##遊覽器不返回錯誤資訊log_errors = On                        ##記錄錯誤記錄檔error_log = /tmp/php_errors.log        ##定義錯誤記錄檔存放路徑error_reporting = E_ALL & ~E_NOTICE    ##設定錯誤記錄檔等級

4、時區

[[email protected] ~]# vi /usr/local/php7/etc/php.inidate.timezone = Asia/Shanghai

5、open_basedir

[[email protected] ~]# vim /usr/local/apache2.4/conf/extra/httpd-vhosts.confphp_admin_value open_basedir "/data/www/123.com:/tmp/"##允許先上傳到tmp目錄下,然後再次轉到其他目錄下


本文出自 “Gorilla Grodd” 部落格,請務必保留此出處http://juispan.blog.51cto.com/943137/1953450

LAMP-php配置最佳化

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.