# Help needed to run php on localhost, it's now making me swear.



## minor_threat (Mar 16, 2005)

Hello helpful people!

I'm running OS X 10.3.8 and have installed MAMO (Macintosh Apache, MySQL and PHP) which is all working well. I can access the MySQL database and mess about with the php in there. However, I would like to be able to open php pages and do some configuration on my powerbook (localhost) and view it all in dreamweaver MX before I upload it to the server. But satan is conspiring against me doing this. 

SQL, php and Apache are all working, and I've followed numerous instructions telling me to drop the php files into the ~username/sites folder.  Fine, this I can do. However, when I point my browser to http://127.0.0.1/~username/ it always loads a really helpful Apache page which asks: "Seeing this page instead of the website you expected?" Too right I am! "Please contact the person responsible for maintaining this server with questions." Well, that would be me. So I contact myself with thousands of questions and get no answers, because obviously I haven't a clue why it's doing this!

Also, if I try to navigate to my page like this: http://127.0.0.1/~username/website/pleasework.php I am told I don't have permission to access it! I've also tried using http://localhost/....

I don't know what else to do. Do I have to do the CHMOD 777 thingy on my laptop/local domain or am I just being a muppet in thinking this has anything to do with it? Any suggestions or even sarcastic criticism will be much appreciated.

MT

(PS: I'm new to this so obscure references to unix commands will fly straight past me.)   

(PPS: And another thing, the really useful Apache page it brings up on screen is called index.htm. I've searched for this file and can't find it anywhere, there are loads of index.htm files but not the Apache one. Where does it magically appear from?!)


----------



## minor_threat (Mar 16, 2005)

Hello again, sorry if it appears like I'm ranting on a bit.

To clarify something, I can go into MySQL database on my localhost and monkey about with pre-installed php pages there. However, what I want to do is play about with a php package called "cutenews".

Obviously, this is my girlfriend's fault because if she didn't spend 24 hours a day on ebay looking for handbags and shoes I'd have the time to configure my php/website online. But whilst she's got a hormonal imbalance it's better to let her be and try to do my php/website offline. I prefer an easy life, plus this way I might actually learn something new about OS X.

Of course, my next questions is going to be: "How do I force her XP laptop to talk to my powerbook and share the broadband connection?" Because at the moment I can't get the stupid XP lump to see my powerbook. But I'll leave that one for now.

Thanks very much.


----------



## minor_threat (Mar 16, 2005)

Right, I've been messing about and done numerous things so I don't know which of my great guesses has had the right effect  but the blasted thing seems to be working!

First I turned off websharing in the Network panel because I wanted Apache off.
Then I loaded MAMP and turned all servers on. (Was Apache installed twice?!)
It still wouldn't work so I searched my computer for the httpd.conf file and opened it in BBEdit with my fingers crossed.
Then I noticed it told me the path of the "DocumentRoot" so I could see where my documents should have been. A good clue as this was a different location to what all of the Apple and Apache insutrctions gave!
I noticed something in the httpd.conf file about "canonicalName directives" so I assigned my powerbook a new IP address and used this in the browser rather than my username.
It was running through port 8888 so I changed this to a different port and the MAMP application seemed to mirror this change as I saved the new httpd.conf file.

Now php works on my local machine and I've stopped swearing and, hey, get this, the sun has even come out! I'm sitting in my office in England and the sun has come out!!   

So, thanks for listening. Tune in tomorrow and watch me talk myself through problem number 2. LOL!

PS: Is it possible to have Apache installed/running on your machine twice?


----------



## aicul (Mar 16, 2005)

I was told: "talking outloud can help you organize your thoughts". 
I guess here "writing outloud seems to have organized your thoughts".

You should be aware that PHP is pre-installed on Panther, but its not activated. All you really have to do is activate it. Something like:

1. open terminal
2. type "open -e /etc/httpd/httpd.conf" this will textedit the httpd.conf file
3. search for "php"
4. remove the # before php line
5. repeat steps 3 and 4 as required
6. search for "<IfModule mod_dir.c>"
7. add index.php after index.html
8. save the changes
9. restart apache using "sudo apachectl start"


----------



## minor_threat (Mar 17, 2005)

aicul said:
			
		

> I was told: "talking outloud can help you organize your thoughts".
> I guess here "writing outloud seems to have organized your thoughts".
> 
> You should be aware that PHP is pre-installed on Panther, but its not activated. All you really have to do is activate it. Something like:
> ...



Thanks Aicul, why can't apple give simple instructions like that instead of 10 pages of bloated text?   People probably think I'm crazy now and will stay away from my posts!


----------



## aicul (Mar 17, 2005)

minor_threat said:
			
		

> why can't apple give simple instructions



Beats many people.

Cheers and enjoy PHP ::angel::


----------

