1,105,242 Community Members

.php files

Member Avatar
geekme
Junior Poster in Training
94 posts since Jan 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
sDJh
Posting Whiz in Training
268 posts since Aug 2005
Reputation Points: 39 [?]
Q&As Helped to Solve: 32 [?]
Skill Endorsements: 0 [?]
 
0
 

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
ninjaface567
Newbie Poster
12 posts since Jan 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

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. :)

Member Avatar
mikulucky
Junior Poster in Training
85 posts since Jan 2012
Reputation Points: 25 [?]
Q&As Helped to Solve: 16 [?]
Skill Endorsements: 0 [?]
 
1
 

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:

127.0.0.1/~YOUUSERNAME/nameOfYourFile.php

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article