Php Problemo

elv1s

Registered
it don't work...

I installed PHP with the instructions from www.entropy.ch and it worked fine on 10.1.5 and I also thought it was fine in 10.2. I did the usual <?php phpinfo(); ?> and that tells me php is working I also have a few scripts (half) working. So php is kind of there. The problem comes when I have to use variables... fairly essential ...basically i can't pass variables to php scripts (the scripts do work as I've tried them on a proper! server). Does anyone have any ideas??


thanks.

(yes i am one of those damn designers who pokes around in areas they shouldn't, stick to drawing pretty pictures I hear you cry)
 
On jaguar, do u use the same php version as on os x 10.1.5?

From PHP 4.2 the variables are sent in a different way:

$variable on php 4.1.x (get and post method)

$_GET["variable"] on php 4.2.x (get method)
$_POST["variable"] on php 4.2.x (post method)

:)
 
I'm currently running php 4.2.3. In os10.1.5 I think it was php 4.2.2 or whatever release worked with os10.1.5. It sounds like you've hit the nail on the head, so what do I have to change. The code that doesn't work looks like this

<?php
if ($Choice<>""){
include("file".$Choice.".txt");
}

?>

do I have to change $Choice to $_GET["Choice"] ??

I appreciate your help 3mors.





ed.
 
you need to edit your php.ini file. And turn on global variables. I'll go get instructions. Be right back.....

Or you can keep doing it the way 3mors said. But i feel as if that's the hard way. I've done both though.

Twister
 
Was $Choice a variable sent by get method?

If yes, u hav to change it with $_GET["Choice"].

Anyway, u can add this line at the beginning of your php page, so u haven't to replace every $Choice.

$Choice = $_GET["$Choice"];

:)

I hope u find it useful.
 
Ok here we go....

Do the following (in the terminal):

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

------------
This is from the FAQ pages HOWTO: Setup PHP $ MySQL here on MacOSX.com, page 9. With this you won't need to add the stuff 3mors is talking about.

Twister
 
Hi Guys, thanks for all of the postings.

I've been trying to figure out why my 4.2.3 installation wasn't working with a php.ini file i had downloaded from php.net -- I was sure i installed the 'latest' .. so I tried, as a hunch, to delete the file and just create a new file in the directory and hey presto ... register_globals on and I'm sure i can experiment with php now and get to see what it can do too.

Just in case some other phpites out there are :confused: struggling - this worked for me .


:D
 
Back
Top