[HOWTO] - Setup PHP & MySQL

Status
Not open for further replies.
yoshi came at the right time there!

By the way, i was presuming we all knew what ~user meant;)

Anyways, good luck!
 
Thanx to you all and of course to Marc Liyanage. I can use PHP and Mysql on my MACOSX 10.1.5 and (almost) everything works fine!

I have only one problem: Sometimes when I start my web server, no ip-adress appears. When this happens, it's also not possible to enter the server with 'localhost'. How is this possible?

The strange thing is that suddenly (e.g. one hour later) the ip-adress appears and my server is running, BUT not with my fixed ethernet ip-adress, but another variable ip-number.

Can anyone help me with this.

Thanx!

Willex
 
I'm really getting frustrated about this... I tried several time, but always this:
[d577a1eb:~] bertrand% curl -O http://www2.entropy.ch/download/libphp4.so.gz curl: (7) Timeout while accepting connection, server busy: 60

I also tried another how to guide, who tells me to use the wget command but this command is "not found"
 
A search of apple knowledge base will reveal directions on how to enable PHP, which is alread installed with OS X (any version), but is disabled from loading by default. It is a really simple process.
 
Hey, did anyone sort out twister's problem with variables not being passed through php? I ask cos I have exactly the same problem. php works fine (so far as I can tell to this point) but variables from html forms are not being passed on submit. the exact same scripts works on my web hosting server. can't find that php.ini file either
 
Nope no answer. I just upload my php files to my shool website. They work there.

If you get an answer let me know.

Twister
 
OK after doing a simple search on http://www.php.net I found the answer to why the variables were not being passed.

this is the answer:

there is a configuration register_globals which is set to off from php 4.2.0 and above by default. It was set to on by default on earlier versions of php.

The way this affects the use of variables is this:

say you pass a variable like so http://www.domain.com?myvariable=value the way to access it if register_globals is on is:
$myvariable
with register_globals off you must access it like so:
$_GET['myvariable']

simmilarialy $_ENV, $_GET, $_POST, $_COOKIE, and $_SERVER.

register_globals off and the latter method of accessing variables is now the suggested way of doing things.

Hope this help other people.

links I found info at:
http://www.php.net/manual/en/configuration.php#ini.register-globals
http://www.php.net/manual/en/language.variables.external.php
 
Hmm, well spotted ekullhu, I was worried about leaving globals on, since it's a security threat. However, some of the PHP scripts I have (from various places) would take me a life-time to change to the new way!

Oh well. Anyway, you can create the php.ini file with just the line register_globals On if you want to test it. Do the following (in the terminal Twister;) ):

cd /usr/local/
ls

[if you don't see the lib directory when you do the 'ls' command, then do the following]:

sudo mkdir lib
cd lib

[you are now inside the lib directory (type pwd in the terminal to confirm this), if you did have the lib idrectory already, you don't need to do sudo mkdir lib] Next:

sudo pico php.ini

[If a file opens up with a load of code then you already have the php.ini file, if not then you should get a blank Pico screen, if so then type]:

register_globals On

[Then press Ctrl-O to save and then Ctrl-X to exit Pico. You now have the php.ini file with Globals on. If you already had the php.ini file with the code already in it, then within Pico, type Ctrl-W and type: register_globals.(Without the full-stop). This'll jump to the line with the command on, just change to On if Off.]

Remember! Finally, you have to restart Apache from the terminal with:

sudo apachectl restart


;)
 
Thanks. But my variables still don't make it across. Weird. Maybe i need to restart the whole computer.

Twister
 
I was following the stepwise intallation (updating apache), because it's what apple.com says I should do, but when I enter the command "make" I get as reply:
make: Command not found.

I have no other idea where to get more info...
in the apache.org files to install it (under unix, I suppose) it also suggests using make
 
all due respect this thread is for PHP problems only.. please do not litter with request for unrelated help.

To All who have done this howto.. I am going to update it sometime this week or next week so stay tuned.

Thank you

~David
 
hey guys, I finally got PHP running. I have a tip. Someone might have said this, but I missed it. once you follow the tutorial, make sure you turn on the web sharing, webserver or whatever it is called. (The option is in the system prefs) And go to http://127.0.0.1/yourscript.php in your browser.
 
Could someone help me? I installed PHP on my Powerbook & 10.2 but it doesn't work 100%.

Here's what i did to install. http://www.entropy.ch/software/macosx/php/

According to php phpinfo() i'm running 4.2.2, the same as my hosting company. But when i try to run the attached files, it only goes through the loop once and doesn't repeat. Why? What might i have set up wrong? I know php is working, just not 100%. And i know the files are coded correctly because they work on my internet site just not locally on my computer.

Please help. I really want this to work.

Thanks
Twister

Files: http://www.twistermc.com/fun.zip
 
I have found my issue!! In searching i found a comment someone made about PHP not noticing Mac like breaks. So i saved out my text file with UNIX line breaks and it worked!!

Twister
 
DOH! I had that problem with a perl script not too long ago. Why didn't I think of that?

BTW, it's a neat bit of code.

-e
 
Status
Not open for further replies.
Back
Top