/    Sign up×
Community /Pin to ProfileBookmark

installed php 4 though it’s not working

Hi I installed php 4 on my mac at work (osx 10.3.3) I made sure I downloaded the right file at entropy.ch

I go to test it, nothing happens, just a white screen, any advice would be appreciated

to post a comment
PHP

14 Comments(s)

Copy linkTweet thisAlerts:
@scragarMar 04.2005 — what do you mean by "you go to test it"?
Copy linkTweet thisAlerts:
@NutterMar 04.2005 — Make a page with .php as the extension in your web root and in it put

<?php
phpinfo();
?>


When you browse to this page, it should give you all sorts of info on PHP. And, it confirms that it's working.
Copy linkTweet thisAlerts:
@T-WagauthorMar 04.2005 — I've already tried testing it, that's how I know it's not working

what I did was went to (in mac) users/~myaccount/sites/ and put in test.php with that command in it. Opened it in safari and nuthin...

am I doint this right?
Copy linkTweet thisAlerts:
@NutterMar 04.2005 — It was totally blank? What's the title for the blank web page? What happens if you view source?
Copy linkTweet thisAlerts:
@T-WagauthorMar 04.2005 — title = untitled document

view source=

<html>

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body bgcolor="#FFFFFF" text="#000000">

<?PHP

phpinfo();

?>

</body>

</html>
Copy linkTweet thisAlerts:
@NutterMar 04.2005 — Ok, it doesn't appear to be parsing the php code (which you've probably already figured out).

Try <?php instead of <?PHP. I don't think it matters, but stranger things have happened.

Does '<?php, phpinfo();, ?>' show up on the page?

What web server software are you using?
Copy linkTweet thisAlerts:
@T-WagauthorMar 04.2005 — All I've done is install php from entropy.ch

bear with me I'm really new to this. I know that apache ships with mac os x, however I haven't touched apache yet, all I've done is install php 4. If i've missed a few steps in the process and need to do something with apache, can somebody please give me some direction
Copy linkTweet thisAlerts:
@NutterMar 04.2005 — Check to see if apache is running. I don't know how to do this in Mac.

You should have a file called httpd.conf. It has commands for what files to parse through the PHP interpreter. You need to make sure .php is being parsed. After any changes to that file you'll need to restart Apache.

I can help on either Linux or Windows, but I haven't used a Mac since middle school (just short of 15 years).
Copy linkTweet thisAlerts:
@T-WagauthorMar 04.2005 — okay I found it ?

how do I edit it in mac? ?

...whimper
Copy linkTweet thisAlerts:
@T-WagauthorMar 04.2005 — aha! nvm.

okay I'm going to try and figure out how to get .php files to be parsed automatically and I'm going to assume that restarting apache is as simple as restarting the computer.
Copy linkTweet thisAlerts:
@NutterMar 04.2005 — Restarting the computer will restart apache. But, there should be a way to do it without going through a reboot. On Windows it's a service you can restart. On Linux it's either 'service httpd restart' or 'apachectl restart'. Hopefully one of those will sound familar to a Mac person.

httpd.conf is just a plain text file, so most any text editor should work.
Copy linkTweet thisAlerts:
@bokehMar 04.2005 — OK! What exactly are you typing into safari to view your file. It sounds like you are viewing the file directly and not via the server. If the server was switch off and you tried to call the file using the server nothing would happen.
Copy linkTweet thisAlerts:
@NutterMar 04.2005 — Didn't even think of that bokeh. Is there http:// on the front of what you're opening or file://
Copy linkTweet thisAlerts:
@T-WagauthorMar 05.2005 — Thanks nutter and bokeh, sorry to make it sound so confusing.

After talking to our server consultant (who charges $75/hour, even to just talk on the phone with me :S) php now works on my machine as an apache module.

For the sake of communal knowledge, here's the nitty gritty:

Of course apache is shipped with osx, that I knew. What I did not know was hat php ships with osx as well, so I didn't need to download it. However, Apache, in this case, was not configured to load or add php as a module.

To alter this I had to open up the httpd.conf file (private/etc/httpd/httpd.conf after changing permissions on the file to read & write) in terminal by typing 'sudo emacs httpd.conf' in the previously stated directory. Then I had to find the lines

#LoadModule-php4 and #AddModule-php4 and remove the # marks in each which made them comments instead of commands. I saved the file by hitting ctrl-x then s then closed it by hitting ctrl x then w. Then I had to restart apache, and I did this by going to system preferences/sharing and disabled personal web sharing then re-enabled it. Baddaboom. I went back to safari, typed http://localhost/~myuser/sites/test.php and it worked fine.

I'm...going to pass out now. have a good weekend all
×

Success!

Help @T-Wag spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...