Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

TheOtherAndy

macrumors member
Original poster
May 20, 2018
72
107
Outside Milwaukee, WI
Hello all,

Years ago I learned PHP in a class at my local tech college. Built a little CMS as you do. That was on Windows using Notepad ++ (or maybe even MS Expressions Web) and WAMP.

I had a little PHP job the other day and forgot how much I actually enjoyed it, despite how frustrating it can be at times. This got me interested in relearning it, with my goal to rebuild my personal portfolio/resume site on a made-from-scratch CMS.

This will be my first foray into coding on Mac. What all would you suggest installing to get this done? What would you recommend for a workflow?

I'm already familiar(ish) with Vagrant and Virtualbox, and the Ubuntu command-line stuff. Git is something I'm also somewhat acquainted with. I've toyed around with VS Code, though on Windows I tend to prefer the more basic Notepad++ (it gets out of the way). I'd also love suggestions for an FTP client that isn't Filezilla (unless someone can make a compelling argument as to why I shouldn't be concerned about the malware thing).

For anyone interested, the Mac in question is a 2017 2.3ghz MacBook Pro with a 256gb drive and 8gb ram (that last number concerns me a little given the fact that I use Virtualbox). As I type, this is docked to a 27" HP monitor. General Mac advice is welcome, too. I've owned a few Macs for a little while, but my main machines have always been Windows boxes.

Thanks, I appreciate the help!
 

theluggage

macrumors 604
Jul 29, 2011
7,979
8,390
This will be my first foray into coding on Mac. What all would you suggest installing to get this done? What would you recommend for a workflow?

What sort of hosting would you be targeting? There are 101 ways of setting up a Mac for PHP development (use MacOS's built-in Apache and PGP, install up-to-date webserver/PHP from homebrew/MacPorts, use MAMP, use Linux via. Virtualbox, use Linux via Docker...) and the one that makes most sense is probably the one that most closely matches your target host environment in terms of webserver/PHP versions, file locations, file permissions, config. etc.

If its going to be basic shared hosting (so everything has to be self-contained, re-locatable, owned by a single user, probably old-ish versions of everything, no access to the server config, just .php files uploaded alongside .htm) I'd either just follow one of the many online guides for enabling built-in Apache/PHP on MacOS or use MAMP to avoid messing with the system config. If you're targeting a "private" server (real or virtual) where you have root access then it might be worth putting in a bit more effort to create a development environment to match.

8GB and Virtualbox shouldn't be a problem if you're just installing Linux with minimal resources for simple web development.

I like VS Code - its now acquired some interesting "remote development" tools so you can run VS Code itself on your Mac and use it as a "front end" for editing and debugging code stored on a virtual/remote machine or Docker container.

FTP: hopefully you mean sftp (unless you're stuck with actual stone-age FTP by some archaic web host) - I have Transmit, which is beautiful and Mac-esque but costs $50. However, for sftp, some alternatives/supplements for people happy to go beyond point'n'click are:

sshfs: https://github.com/osxfuse/osxfuse/wiki/SSHFS

VS Code: now includes an sftp client

rsync: can work over ssh to a *nix system that also has rsync - command line but worth learning because it is super-fast and efficient at only copying what is needed. My preferred technique for regularly updated websites is to write a little bash script called something like "upload_to_live.command" that rsyncs the code with the server.

git: can 'push' revisions via ssh and, with a bit of woo-woo that you can easily find via google you can set up a hook on the server so that the new revision you push gets automatically checked out. Never tried this in anger but it sounds good on paper. Of course, it means you need git and a copy of the git repository on the server,

Also Cyberduck still seems to be a thing... Haven't tried it.
 
  • Like
Reactions: mikzn

mikzn

macrumors 68040
Sep 2, 2013
3,005
2,293
North Vancouver
Another vote for Transmit for FTP - and it can be linked to your "text and code editor" for easy editing and saving of scripts within transmit app while connected to server, PHP files, HTML etc and can have different extension codes for different editors ( ie CSS editor) / (PHP editor)

BBedit / Text Wrangler - might be worth checking out as an PHP/HTML editor - free version and paid version available

Coda - for a more robust integrated code editing solution with Transmit - same developer as transmit
 

TheOtherAndy

macrumors member
Original poster
May 20, 2018
72
107
Outside Milwaukee, WI
Excellent, thanks guys! I've been happy with Limenex's hosting, so I'd probably stick with it. However, I'll probably avoid the MAMP route. I'm in school for IT, and being able to configure a server is a good skill to have, I'm sure.

I've actually played around a bit with cyberduck. It took a bit of getting used to, but I was okay with it. For the record, I use Winscp on Windows. BBedit I haven't used, but Mac Geek Gab mentions it constantly and I trust their opinion (even if it is a sponsor).

Off-topic rant: I've just run into my first real development problem at work (Windows PC). I'm building a Woocommerce shop on a vagrant-managed virtual box, and boy howdy is that thing slow. Any page load takes forever. Supposedly winnfsd helps, but it requires host-only network connection and I need management to be able to access it. I'm thinking I'll have to stop using shared folders and instead just do my development strictly on the vm. Thoughts welcome.
 

Puppuccino

macrumors 6502
Sep 24, 2019
450
429
United Kingdom
The easiest way I think is to download the Atom editor (it's free), and then download Local by Flywheel (also free). Local is mainly used for WordPress development, but you can actually build anything with Local if you want to.

As for learning php, check the documentation as it's really useful. There's a million and one guides out there on how to learn php. Some free and some not.
 

sevoneone

macrumors 6502a
May 16, 2010
951
1,290
I found this free series from Laravel/Laracasts to be really helpful. I knew enough PHP to be mildly dangerous, but nothing about the best structures and practices to use. This really helped: https://laracasts.com/series/php-for-beginners

As for a dev environment. I always remind people that Google Cloud offers a 100% free fractional VM instance including 30GB of storage and a static IP address. 600MB of RAM and 0.2 CPU threads isn’t a lot, but it is kinda cool to have a little test box in the cloud you can SSH into from anywhere including your iPhone/iPad.
 

TheOtherAndy

macrumors member
Original poster
May 20, 2018
72
107
Outside Milwaukee, WI
Ah, I will definitely check out that Laracast series. Thank you very much.

Unfortunately, I haven't even had time to get started yet (aside from the stuff I've had to do at work). Holidays, overtime, and school (just started learning Python) have gotten in the way. Soon, hopefully. Maybe I'll force myself to do a bit this weekend.

As a follow-up to my rant about my Windows development issue: I set myself up a Windows Subsystem for Linux environment. For the uninitiated: Windows now allows you to install Linux... inside Windows (I guess). Seems like some weird 'woo woo' thing, but it is phenomenally faster than Vagrant was.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.