?
Solved

HTTP_COOKIE does not appear in phpinfo()

Posted on 2009-04-09
4
Medium Priority
?
947 Views
Last Modified: 2013-12-13
Hi.

I am trying to set up a MacBook Pro running OS X Leopard 10.5.6 as a webserver to do some php development on during the coming holidays.
The server software is apache 2.2.9, with php 5.2.5
No matter how I try, i can't get sessions to work.
Inspecting the phpinfo page showed the entry for HTTP_COOKIE to be missing, which i assume is why sessions won't work.
Any ideas on how to remedy this ?

0
Comment
Question by:KristiaanD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 6

Expert Comment

by:James Looney
ID: 24115609
I have cookies enabled but that var does not show on my phpinfo either.

Are you wanting to use cookies or sessions?

And have you tried just some simple tests like create a php script with the following just to see which is working:



<?php
$value = 'something from somewhere';
setcookie("TestCookie", $value, time()+3600);
 
session_start();
$_SESSION['test'] = 'Hi';
 
// Another way to debug/test is to view all cookies
var_dump($_COOKIE);
 
var_dump($_SESSION);
?>

Open in new window

0
 
LVL 6

Expert Comment

by:karlwilbur
ID: 24173307
It is not showing up because you are not passing it any cookie info for that domain on that request.

Try the code below. You will have to hit the page more than once. The first time it sets the cookie. The second time the browser will pass the cookie back, then you will see cookie info.
<?php
session_start();
phpinfo();

Open in new window

0
 

Author Comment

by:KristiaanD
ID: 24285346
Sorry for the delay in replying to the comments - I have been abroad for a few weeks.
With the above code snippets things still didn't work.
I finally resolved to reinstalling the system on the MacBook, thereby falling back to the original PHP installation as provided by Apple. After that things worked as they should.
However: since the apple installation doesn't come with all the extensions that I'd like to use for the website (like mcrypt and gd), this is not a very satisfying solution.
I've read articles on the net on compiling PHP yourself, but this does seem a daunting task.
Any suggestions ?
0
 
LVL 6

Accepted Solution

by:
karlwilbur earned 1500 total points
ID: 24286093
Compiling yourself is not a daunting a task as it may seem.

Minimally, you may be able to download the PHP source for the version of PHP installed as the Mac Default and compile the gd and mcrypt packages for it. (essentially you compile a brand new PHP installation, but only use the gd and mcrypt modules by copying only those modules into your PHP modules directory)

I use Ubuntu and the package manager allows me to install gd and mcrypt as additional, optional packages. You should start by looking to see if there is a way to install those "optional" packages on the Mac.

This may be a good place to start regardless of what method you decide to employ:
http://developer.apple.com/internet/opensource/php.html
0

Featured Post

Tutorial: Introduction to Managing a Linux Server

In this tutorial on systemd, we will explore:
-OS/Distro Adoption
-chkconfig and Other Legacy Commands
-Summary and Key Commands

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question