开发者

PHP - Terminal/Command line - Mac

I'm following a video tutorial that is developing a project in PHP. The teacher is buildi开发者_运维知识库ng the site on a local server, but I am doing it directly onto a website on a shared hosting plan. At one point in the tutorial, the teacher is using the command line on his computer to change file permissions. Is it possible for me to connect to the webserver on a shared hosting plan from the terminal/command line on my Mac? if so, how to do it?


You need SSH access to your web server, so you might need to get in touch with your provider and find out if this is available to you.

You can SSH from your terminal to your webserver like:

ssh user@webserveraddress


The most common method would be to use SSH. Your mac should have an ssh client built in.

ssh yourhostname.com

This of course all assumes that your provider allows ssh access.


You can do this using your ftp client (Filezilla?)


You could use the exec function in PHP to execute simple commands on the command line. More details of this function you find at: http://php.net/manual/en/function.exec.php

If it is something that you need to do more often you can also consider building a very basic terminal application in PHP, which allows you to insert command in a HTML input box and executes it via the command line. The reply from the command line can be published in the HTML page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜