LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-12-2013, 09:41 PM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Blog Entries: 1

Rep: Reputation: 90
php on apache - is it possible to change session on a running request from another?


Hi!

I think I'll have to create a php script that will generate a stream (sound) to be played on the client.... the thing is that the script has to generate content according to some variables that should be able to be modified by interacting on the client side.... so I want to know if it's possible to see a change on $_SESSION after the script is running if I change a it from another script/request. In case it's not possible, what are the options for some kind of IPC of this kind?

Thanks in advance.
 
Old 06-12-2013, 11:36 PM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,852
Blog Entries: 1

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
According your plans, how long (in seconds/minutes/hours) your sound-stream-creating PHP script will be running?
 
Old 06-13-2013, 01:08 AM   #3
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
Seconds, minutes.
 
Old 06-13-2013, 02:22 AM   #4
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,852
Blog Entries: 1

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
And during that time you want to interact with the running PHP-script?
(Note: I'm not sure Apache will allow your PHP to run for minutes)
 
Old 06-13-2013, 06:57 AM   #5
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
Yes, in a utopic world i should be able to change its behavior by using some kind of ipc.
 
Old 06-13-2013, 07:36 AM   #6
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,852
Blog Entries: 1

Rep: Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868Reputation: 1868
And who is the other party in the IPC?
 
Old 06-13-2013, 07:44 AM   #7
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
Another script that is responding to a request from the client.
 
Old 06-13-2013, 08:45 AM   #8
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,450

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
Hi

When one script is running with a started session, other scripts with the same session id will wait until the first is finished. So it can't be done with $_SESSION.

But it can be done. The content sending script should do a "session_write_close" in the beginning. Then $_SESSION is still available, but read only. This will allow other scripts with the same session id to run. It then has to check something shared every now and act when it sees the changes.

The "shared" can be many things. You could use regular files, like $_SESSION does by default. Or a database. Or you can use shared memory. I think a simple file in /tmp would probably be the easiest. The filename could be generated with tempnam() and stored in $_SESSION.

http://www.php.net/manual/en/book.shmop.php

http://www.php.net/manual/en/book.sem.php
 
1 members found this post helpful.
Old 06-13-2013, 08:47 AM   #9
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092

Original Poster
Blog Entries: 1

Rep: Reputation: 90
I'll take a look. Thanks
 
  


Reply

Tags
ipc, php, session


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
session_id same but session data lost between subdomains php apache davidoff2011 Debian 1 02-17-2011 04:19 PM
Centos 5.2 running Apache 2 and PHP 4 cannot display info.php codenjanod Linux - Server 2 08-19-2008 02:00 AM
php not running on apache 1 LinuxCrazy Linux - Server 7 06-06-2007 03:27 PM
Help with PHP,Apache, and a put request? graystarr Linux - Server 1 04-04-2007 05:54 PM
running apache 2.2 with php 5 sharathg786 Linux - Networking 1 07-19-2006 05:23 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration