An example of constructing linux+php development environment _php in Win7

Source: Internet
Author: User
Tags fpm php development environment windows 7 x64 ftp client ssh sublime text

I used more than 3 years of Linux desktop, is very uncomfortable, mainly the experience of various software is not uniform, too fragmented, too many choices make people have no choice.
And back to Windows, it's even worse, using the *nix toolset becomes very frustrating, and deploying the WEB environment is cumbersome, and my servers are Linux, and there are some features in the code that can't run on windows.

Because I occasionally play games, one months ago, I chose to return to the Windows desktop.
But my next software is almost always cross-platform, and if you're using a Linux desktop, it won't have any impact.

My host is Windows 7 x64, then runs an Arch virtual machine, all the code running and debugging in the virtual machine.

Arch Virtual Machine

Arch installation slightly toss, but I like it KISS philosophy, I use VirtualBox, allocate 512MiB or even 256MiB is enough.
Network changed to "Bridge network card" and then set a MAC binding in the router fixed IP, I gave the virtual machine is 192.168.0.105, and my host is 192.168.0.100.

The core of the packages that need to be installed are: OpenSSH, Nginx, mariadb, PHP, Xdebug.
As for others: Vim, MongoDB, Php-mongo, phpMyAdmin depends on the individual needs.

It's inconvenient to knock commands directly on the VirtualBox Virtual machine window, and I'll install a virtual desktop software called Virtuawin, similar to KDE's Workspace (workspace), and throw VirtualBox windows to another desktop.
And then use the Xshell even SSH up to knock orders.

Of course you also need to build a non-root account for daily use, I built a jysperm.
Then you can modify the/etc/php/php-fpm.conf:

user = Jysperm
Group = Jysperm
This PHP-FPM process will run with your users, and read and write files will not encounter any permissions issues.

As a development server, it may be necessary to develop and test multiple projects, each time to go to the Nginx inside the new site is very frustrating thing, the following configuration file can make you once and for all:

Copy Code code as follows:

server {
Listen 80;
server_name ~ (? <dir>.*) \.ab\.jyprince\.me$;

Access_log/home/jysperm/nginx.access.log;
Error_log/home/jysperm/nginx.error.log;

Index index.html index.php;
AutoIndex on;

root/home/jysperm/$dir;

Location/{
Try_files $uri $uri//index.php $args;
}

Location ~ \.php$ {
Fastcgi_pass Unix:/run/php-fpm/php-fpm.sock;

Fastcgi_index index.php;
Include Fastcgi_params;
}
}

*.ab.jyprince.me This domain has been resolved by me to 192.168.0.105, so that only access to test.ab.jyprince.me, the equivalent of access to the file in/home/jysperm/test, the future will not be modified Nginx's configuration file.

Phpstorm

The best IDE I've ever seen is phpstorm.

Phpstorm's deployment function can be automatically deployed to the server each time you modify the file, you only need to build a SFTP type of server, and the information of the Arch virtual machine, and then check Automatic Upload.
Each item is uploaded to a folder under/home/jysperm.

Then you can access the project name. Ab.jysperm.me, everything is automatic.

Remote debugging

To modify/etc/php/conf.d/xdebug.ini in an Arch virtual machine:

Copy Code code as follows:

Zend_extension=/usr/lib/php/modules/xdebug.so
Xdebug.remote_enable=on
Xdebug.idekey=jysperm
xdebug.remote_host=192.168.0.100
xdebug.remote_port=9000

Then create a new PHP Remote Debug in Phpstorm.
When you need to debug, turn on debugging in Phpstorm, set a breakpoint, and let the request take a xdebug_session=jysperm Cookie.
When debugging the page, you can use this tool to generate bookmarks, click on the bookmark to control the debugging switch.

Debugging the RESTful API I typically use a Chrome extension called postman, which doesn't seem to have the ability to edit cookies, so add an item to the HTTP Header cookie:xdebug_session=jysperm On the line.

Other recommended

Robomogo-Cross-platform Mongo GUI Client
Git GUI under Sourcetree-windows
SSH in Secure shell-chrome
Clover-Make Windows resource manager like Chrome
FileZilla-Cross-platform FTP Client
Smartgit-Cross-platform Git GUI
Sublime Text-Useful cross-platform editor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.