I'm following a video tutorial that is developing a project in PHP. The teacher is building 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?
2
-
1Does your hosting provider provide SSH access? If not you can't. But you can always change file permissions with a FTP client.Felix Kling– Felix Kling2011-03-09 08:53:29 +00:00Commented Mar 9, 2011 at 8:53
-
and also with PHP itself: chmod ("/somedir/somefile", 0755);felixsigl– felixsigl2011-03-09 08:54:32 +00:00Commented Mar 9, 2011 at 8:54
Add a comment
|
4 Answers
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.