0

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
  • 1
    Does your hosting provider provide SSH access? If not you can't. But you can always change file permissions with a FTP client. Commented Mar 9, 2011 at 8:53
  • and also with PHP itself: chmod ("/somedir/somefile", 0755); Commented Mar 9, 2011 at 8:54

4 Answers 4

1

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
Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

0

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

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.