问题
I'm on a MacBook running OS X trying to teach myself how to write CGI scripts and I'm stuck on the very first step, altering the httpd.conf file. I'm following these instructions: http://www.cgi101.com/book/connect/mac.html and I'm trying to alter the httpd.conf file using the terminal command sudo vim /etc/apache2/httpd.conf. However when I get ready to try and save the file it says that it's read-only. The instructions that I'm following say that I'm supposed to uncomment the line AddHandler cgi-script .cgi however, how am I supposed to do this if I can't save the file?
I'm very new to CGI scripts, Apache and terminal in general.
EDIT: The output from the command: ls -l /etc/apache2/httpd.conf is:
-r--r--r-- 1 root wheel 24330 Jul 11 2011 /etc/apache2/httpd.conf
EDIT: When I try to save it says add ! to override. When I do so using the command :!x it exits out but produces the error launch_msg("CheckIn") IPC failure: Operation not permitted.
回答1:
To save read-only file add ! after Vim command, not before. If you add it after, then it will try to run shell command (not Vim command). In this case you are running shell command named x, that prints message that you mentioned. You need :x! to save and close or :w! to just save file.
来源:https://stackoverflow.com/questions/11333267/how-to-change-apache-httpd-conf-file-on-mac-os-x