The PHP environment is in linux, But windows is used during development. So I used samba to share a directory in linux and then map it on windows, in this way, you can directly edit files on linux in windows.
First of all, install samba software. I use yum to install it. This is really convenient, and I personally feel that this version is not very demanding, so you don't have to use the source code to compile and install it.
Check whether samba software has been installed. I use centos 6.3 64bit,
Rpm-qa | grep samba
samba-common-3.5.10-125.el6.i686samba-client-3.5.10-125.el6.i686samba-3.5.10-125.el6.i686samba-winbind-clients-3.5.10-125.el6.i686
If there are a few, it indicates that it has been installed. If not, enter yum-y install samba for installation.
After installation, edit the configuration file vi/etc/samba/smb. conf.
The configuration file contains four configuration segments:
[Global] set global environment options
[Homes] set the user's home directory sharing
[Printers] Set printer sharing
[Program files] set file sharing
[Global] Section main options:
Workgroup = MYGROUP // specify the Working Group or domain. This does not seem to be set.
Server string = Samba Server Version % v // description
Hosts allow = 127. 192.168.12. 192.168.13. // allow access from these ip addresses or ip segments. If not set, all ip addresses can be accessed.
Hosts deny = 192.168.70.100 // disable access from these ip addresses
Note: Generally, hosts allow and hosts deny do not appear at the same time. If they appear at the same time, priority is allowed.
Log file =/var/log/samba/% m. log // location where the log file is stored (disabled by default ).
Max log size = 50 // specify the maximum value of the log file (disabled by default)
The main options of the [homes] Section are as follows:
Comment = Home Directories // description
Browseable = no // indicates that only the user's home directory is displayed.
Writable = yes // write permission
Because samba users must be users in the system, and each system user has its own home directory. The above section indicates that the home directory has read and write permissions.
Below is the most important section in the configuration. For example, if I want to share the/blog directory, the shared display name is also called blog, so that the root user has the read and write permissions, set it like this.
[Blog] // display name
Path =/blog // shared path
Valid users = root // user, which must exist in the system
Writable = yes // whether you have write permission
Save and exit.
Execute smbpassword-a root // Add the root user to samba, and then prompt to enter the password
Smbpassword root // This is used to change the password
Then start the samba service and service smb start
You can use service smb stop to stop a service.
To set samba to self-start, run chkconfig smb on
You can enter smbstatus to view the samba status.
Then input \ your linux ip address in start-> Run.
If the connection fails, check whether/etc/init. d/iptables status is enabled for iptables.
If a large part is displayed, it indicates that the firewall is enabled, or the port is opened to samba, or iptables is disabled. I chose to disable/etc/init. d/iptables stop.