Hello,I've created a php file in textWrangler saved with .php extension on the desktop.But it does not open in the browser? Please help.

Recommended Answers

All 3 Replies

Why do you want to open it in a browser? PHP needs to be executed on a server.

Anyway: Right click on the document. If there's no item called "Open with" then try holding these keys: Shift, Ctrl, Alt and Cmd. I don't remember which one is the beste choice, but you can see some items in the menu changing. You can then access "Open with".

Or, you open the browser and choose the file via the global menu "File".

Member Avatar

If you want to run PHP files on your own computer, I suggest you install MAMP.

To run PHP files, they have to actually be on a server with PHP installed. MAMP basically installs a server on your computer with PHP, so that you can put your PHP files in the MAMP directory and you will be able to run them in your browser. :)

Apache is installed on all macs. Do the following:

  1. Open a terminal
  2. type "cd /etc/apache2/"
  3. type "sudo pico httpd.conf", enter your password when requested
  4. find the line #LoadModule php5_module libexec/apache2/libphp5.so and remove the '#'
  5. save the file
  6. then go to system preferences, sharing and turn on 'Web Sharing' or turn it off and on if all ready on
  7. put the .php file in your sites folder.

In the web browser go to the following:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.