I suspect the problem is the Apache config on my Mac but have researched andmade changes but to no avail.
We're going to need more details! Is the web server running? Where is the script you're trying to run located?How are you trying to get it to run in a browser, i.e. what URL are you browsing?
What are its permissions? What are its line-breaks? What happens when you browse it?