Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What the....? PHP has gone mad

Status
Not open for further replies.

SPYDERIX

Technical User
Joined
Jan 11, 2002
Messages
1,899
Location
CA
Hi,

I have been having alot of problems with PHP today. I have a script that I'm making and it uses sessions and I got it to work exactly the way I wanted it to. I didn't make any changes to it (NONE, NADA, ZILCH) and all of a sudden the script screwed up and didn't work properly. So I restarted my whole machine and then it worked perfectly without touching the script at all. And then just out of the blue it stopped working again and it couldn't get variables that were posted directly to it.

Then I decided maybe there is a bug and so I went to get the latest php Win32 Binary installation download. Downloaded that, deleted my old php folder, put in the new one, took the php-ini-dist file and created my .ini file and put it in C:\WINNT\ and php worked, and then I ran phpinfo(); and php is so screwed up. It says the current install in still the old version PHP v 4.3.1 when it should be PHP v 4.3.2 and it says I am running Apache 1.3.24 when in fact I am actually running Apache 1.3.27.

Can anyone explain this?????

This is so weird.

Thanks alot!

Nate

mainframe.gif

 
Can you post some troubleing code or explaing on what circumstances?
I never had session problems on win machine.

________
George, M
 
I'm guessing here, cause this is one of those, I'd need to see the machine kinda things.

But is there any chance that you have more than one install of Apache going?

If you run a directory listing through apache, does it report 1.3.27 or 1.3.24?

How did you un-install PHP? Once uninstalled do you try to load a PHP script before re-installing to be certain it was gone?

-Rob
 
skiflyer,

No I only one have one version of Apache installed. The server is 1.3.27 when phpinfo(); shows everything it shows the server signature as being 1.3.27 yet shows the version as being 1.3.24 and I find that quite odd. I un-installed PHP by deleting the whole folder, it wasn't in the Add/Remove programs list b/c I have it installed as binary and not installed from an .msi or .exe. So I deleted all the files, then did try to run a script and it didn't work, and then extracted all the new ones from the .zip from php.net then took the php-ini-dist file and made a brand new one of those. Then restarted apache and php was working but screwing up by saying it was 4.3.1 still.

sleipnir214,

I did shut it down. I remember trying to start it but it wouldn't let me b/c php wasn't there and it's installed as a module but then as soon as php was there, apache started, so yes I did shut it down.

shaddow,

My script does this:

Code:
	if (isset ($_POST["graphic_service"]))
		{

		$sub_service = $_POST["graphic_service"];
		session_register("sub_service");

		switch ($sub_service)
			{
			case web_site:
			$sub_service_output = "Web Site Graphics";
			session_register("sub_service_output");
			break;

The problem is that the session isn't registering properly. It registers $sub_service as what $sub_service_output is and then doesn't register $sub_service_output at all.

Thanks alot!

Nate

mainframe.gif

 
Ok first of all i think you should register a variable first before use, i think registering a name that is already taken it overwrites it.
Also try to use session_start() as first php line and also !session_is_registered() for checking it.
i dont like using isset() function cuz i think it's not the way it works for checking a post variable, try to use empty().

Always worked for me both windows version and linux.
It should be like this.
Code:
session_start();
...
   if (!empty($_POST["graphic_service"]))
        {

        session_register("sub_service");
        $sub_service = $_POST["graphic_service"];
        switch ($sub_service)
            {
            case web_site:
            session_register("sub_service_output");
            $sub_service_output = "Web Site Graphics";
            break;
...

This should work no matter what platform you use.

________
George, M
 
Actually with 4.3.x you should just forget about registering the variables and put them in the $_SESSION array. Well, ok maybe should is too strong a word, but it's definately the easiest method, and from the manuals it feels like it's the direction the language is going.

-Rob
 
The manual gives you a choice -- either use global variables ($foo) and session_register() or use references to $_SESSION and not use session_register().

I recommend direct references to $_SESSION.

You know the values will always be in $_SESSION, but $_SESSION['foo'] will only be registered as $foo if the setting for register_globals is "on". References to $_SESSION make your code more portable.

Also, six months from now, you may not remember wher $foo came from, but $_SESSION['foo'] is obvious.

Want the best answers? Ask the best questions: TANSTAAFL!
 
Hi,

Well I don't seem to have this prob now anymore, so maybe the original install became corrupt, and not re-installed it all works well. However it still doesn't explain why the new version was saying it's the old one.

Did I in fact remove it correctly? Is there anything else that is installed somewhere that needs to be over-writen or removed etc?

Thanks!

Nate

mainframe.gif

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top