为什么下载源码包需要到官网上去下载?
1. 為什么下載源碼包需要到官網上去下載?
答:官網提供的源碼包更完整,無修改,無病毒,無后門。
2. 64位機器是否可以安裝32位rpm包?64位機器是否可以安裝32位的mysql二進制免編譯包?
答:可以,但是不建議這樣做,最好是安裝對應版本的包,不容易出問題。
3. 編譯安裝apache時, 會有什么問題?
答:編譯安裝apache需要底層接口庫apr的支持,如果不加--with-included-apr參數,會編譯出錯:Cannot use an external APR with the bundled APR-util
4. 編譯php時,必須加上 --with-apxs2=/usr/local/apache2/bin/apxs 這是什么意思呢?
答:使用apache自帶的apxs工具將編譯產生的php動態鏈接庫libphp5.so自動加載到apache的模塊列表中,如果不使用該工具,則需要手動添加。
5. 當配置好apache的配置文件后,如何檢驗配置文件是否正確?
答:使用apache自帶的工具apachectl -t選項檢測配置。
6. 如何查看80端口是否啟動?
答:netstat -lnp |grep ':80'
7. 更改apache配置文件httpd.conf后,如何重新加載配置文件?
答:apachectl graceful
8. 如何查看apache加載了哪些模塊?
答:apachectl -M
9. 怎么查看php加載了哪些模塊?
答:php -m
10. 簡單描述靜態加載和動態共享模塊的區別。
答:靜態加載是在編譯時將模塊一同編譯進可執行文件中,可執行文件較大,但是執行速度快;動態加載是將模塊和可執行程序分開編譯,執行時調用模塊功能,可執行文件較小,執行速度較慢。
11. 當我們配置好lamp環境后,訪問php程序無法解析,你如何去排查這個問題呢?
答:首先 /usr/local/apache2/modules/目錄下得有libphp5.so模塊
然后 httpd.conf 中得有 LoadModule libphp5.so 語句
同時 httpd.conf 中得有 AddType application/x-httpd-php .php 語句
最后 apache 要重新加載配置文件
12. 如何配置apache的虛擬主機
答:編輯apache主配置文件:vim apache2/conf/httpd.conf
去掉 #Include conf/extra/httpd-vhosts.conf 最前面的注釋符 #,并且修改:
Deny from all 為 Allow from all
最后編輯虛擬主機配置文件:vim ?apache2/conf/extra/httpd-vhosts.conf
根據實際需求修改相關內容
13. 如何配置apache的用戶驗證
答:[root@CentOS6 ~]vim ?/usr/local/apache2/conf/extra/httpd-vhosts.conf
……
<VirtualHost *:80>
DocumentRoot "/data/www"
ServerName www.test.com
ServerAlias www.mydiscuz.com
? ?<Directory /data/www/important/>
? ? ? ?AllowOverride AuthConfig
? ? ? ?AuthName "username"
? ? ? ?AuthType Basic
? ? ? ?AuthUserFile /data/.htpasswd
? ? ? ?require valid-user
? ?</Directory>
</VirtualHost>
……
[root@CentOS6 ~]# htpasswd -c /data/.htpasswd jack
New password:123456
Re-type new password:123456
Adding password for user jack
14. 如何配置apache的日志以及日志按天切割
答:[root@CentOS6 ~]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
……
<VirtualHost *:80>
DocumentRoot "/data/www"
ServerName www.test.com
ServerAlias www.mydiscuz.com
ServerAlias www.others.com
?ErrorLog "logs/test.com-error_log"
? ?CustomLog "| /usr/local/apache2/bin/rotatelogs -l /usr/local/apache2/logs/test.com-access_%Y%m%d_log 86400" combined
……
15. 如何配置apache的圖片等靜態文件的過期時間
答:[root@CentOS6 ~]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
……
CustomLog "| /usr/local/apache2/bin/rotatelogs -l /usr/local/apache2/logs/test.com-access_%Y%m%d_log 86400" combined env=!p_w_picpath-request
<IfModule mod_expires.c>
? ? ? ?ExpiresActive on
? ? ? ?ExpiresByType p_w_picpath/gif "access plus 1 days"
? ? ? ?ExpiresByType p_w_picpath/jpeg "access plus 24 hours"
? ? ? ?ExpiresByType p_w_picpath/png "access plus 24 hours"
? ? ? ?ExpiresByType p_w_picpath/css "now plus 2 hours"
? ? ? ?ExpiresByType application/x-javascript "now plus 2 hours"
? ? ? ?ExpiresByType application/x-shockwave-flash "now plus 2 hours"
? ? ? ?ExpiresDefault "now plus 0 min"
? ?</IfModule>
<IfModule mod_rewrite.c>
……
16. 如何限定某個目錄下的php文件沒有執行權限
答:[root@CentOS6 ~]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
……
<Directory /data/www/important>
? ? ? ?php_admin_flag engine off
? ? ? ?<filesmatch "(.*)php">
? ? ? ? ? ?Order deny,allow
? ? ? ? ? ?Deny from all
? ? ? ?</filesmatch>
? ?</Directory>
……
17. 如何配置apache的域名重定向
答:[root@CentOS6 ~]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
……
<VirtualHost *:80>
DocumentRoot "/data/www"
ServerName www.test.com
ServerAlias www.mydiscuz.com
<IfModule mod_rewrite.c>
? ? ? ?RewriteEngine on
? ? ? ?RewriteCond %{HTTP_HOST} ^www.mydiscuz.com$
? ? ? ?RewriteRule ^/(.*)$ http://www.test.com/$1 [R=301,L]
? ?</IfModule>
……
18. 如何配置php的錯誤日志
答:[root@centos6 ~]# mkdir /usr/local/php/logs
[root@centos6 ~]# chmod 777 /usr/local/php/logs
[root@centos6 ~]# ?vim /usr/local/php/etc/php.ini
……
; Example:
error_log = /usr/local/php/logs/php_errors.log
; Log errors to syslog (Event Log on Windows).
……
; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
; http://php.net/error-reporting
error_reporting = E_ALL & ~E_NOTICE
……
19. 如何在php中配置open_basedir, 是否可以在httpd.conf 中針對虛擬主機配置open_basedir?
答:[root@centos6 logs]# ?vim /usr/local/php/etc/php.ini
……
; open_basedir, if set, limits all file operations to the defined directory
; and below. ?This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
; http://php.net/open-basedir
open_basedir = /data/www/:/tmp/
……
可以在httpd.conf 中針對虛擬主機配置open_basedir:
[root@centos6 logs]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
……
<VirtualHost *:80>
# ?ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/data/www"
ServerName www.test.com
ServerAlias www.aaa.com
ServerAlias www.bbb.com
?php_admin_value open_basedir "/data/www/:/tmp/"
<Directory "/data/www">
AllowOverride None
Options None
……
20. 如何禁止php的函數exec
答:[root@centos6 ~]# vim /usr/local/php/etc/php.ini
……
; This directive allows you to disable certain functions for security reasons.
; It receives a comma-delimited list of function names. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
; http://php.net/disable-functions
disable_functions = eval,assert,popen,passthrn,escapeshllarg,escapes
hellcmd,passthru,exec,system,chroot,scandir,chgrp,chown,escapeshellc
md,escapeshellarg,shell_exec,proc_get_status,ini_alter,ini_restore,d
l,pfsockopen,openlog,syslog,readlink,syslink,leak,popepassthru,strea
m_socket_server,popen,proc_open,proc_close
21. 我們以源碼安裝LAMP環境時,先安裝哪個,后安裝哪個?為什么呢?
答:php依賴于MySQL,還需要使用Apache的apxs工具,所以只要是最后安裝PHP即可。
22. 怎么確定你的php.ini 在哪個目錄下?
答:php -i |grep 'Configuration File'
23. 怎么確定你的php的extension_dir 在哪里?
答:php -i |grep 'extension_dir'
轉載于:https://blog.51cto.com/rachy/1892296
總結
以上是生活随笔為你收集整理的为什么下载源码包需要到官网上去下载?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java获取数据库的列名,类型等信息
- 下一篇: Oracle新建用户赋只读某几张表的权限