Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Sending Signals To Processes As A Different User Than Owner Using Php


i know, it seems more to be a problem according to unix but i got it while
developing software with php:
i have 2 different users on a hp-ux machine that execute php scripts. they
are both in the same group.
these php scripts start background processes, i can communicate with using
signals (sending with posix_kill, starting background processes via
pcntl_fork).
so i got severel background processes owned by my 2 users.
the problem is i want to send signals as one of my 2 users to all my php
background processes no matter who of my 2 users is the owner. is it
possible other than using external tools like sudo?
i'm using:
PHP 4.3.4 (cgi) (built: Aug 18 2004 15:37:46)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies

compiled with:
../configure' '--prefix=/usr/local/php-cgi-saprfc' '--enable-calendar'
'--enable-filepro' '--with-gd' '--with-jpeg-dir=/usr/local'
'--with-zlib-dir=/usr/local' '--without-mysql' '--enable-sysvsem'
'--enable-sysvshm' '--with-pgsql=/usr/local/pgsql' '--enable-trans-sid'
'--with-cpdflib=/usr/local' '--enable-sockets' '--with-ncurses=/usr/local'
'--disable-shared' '--with-tsrm-pthreads' '--with-saprfc=/usr/local/rfcsdk'
'--enable-pcntl




View Complete Forum Thread with Replies

Related Forum Messages:
Receiving Regular Signals To My Script
I want my script (or a function inside a script) to be called automatically once every day in order to do some daily diagnostics and cleanup. Does anyone no how to achieve this?

pcntl functions dealing with signals doesn't seem to be working, it doesn't recognize the function names. My provider is running PHP in safe mode, in case you would need to know.


View Replies !
Sending User To Another Page ?
I want to do something simple, here is the code:

<?php

if($ageCheck)
// goto mainpage.html
else
// goto under21.html

?>

What is the best way to do that ? I looked at header() but I'm not sure if
that's the best way.

View Replies !
Sending A File To User (again)
I asked this a couple of days ago, but got no response. Surely it's not
difficult?

I have a file, which my PHP has created, called say, /tmp/fred.txt. I want
to send that file to the user so a dialog pops up and they get to save
'fred.txt' (or whatever they name it) on their local disk.

View Replies !
Copy And Owner
Problem being that if i copy files using a php script they get the owner 99, which i suggest is something like php themselves. This is a pain because now i cannnot delete these files anymore with my ftp program.

View Replies !
Changing Owner Of A Directory?
When I create a new directory manually, it has the owner of my username, but when I get PHP to create a new directory using mkdir() and setting permissions to 777, it has the owner of "apache".

This is causing a problem as when I try to copy files, or move files into a folder that has "apache" as the owner, it won't do it. It works fine when the owner is my username.

I've been having a go with chown() but with no luck. But I'm not sure if that works on directories, as well as files. I can't seem to find much information about changing owner status on directories, so if anyone can shed and light on this or help I would be very grateful!

I really need to be able to create a new folder in PHP but have the owner as my username, but not apache, which appears to be the default!

View Replies !
Script Creates Owner As Apache
I am using a fantastic script called Photofolio from www.billwadman.com/photofolio and everything is awesome with it except that when you call the file "buildthumbnails.php" and it builds your thumbnail folders it creates them with the owner name as "apache" and permissions at 644. The problem here that you may suspect is that I cannot go in and delete those files in any of my FTP programs of DW because I am not the "owner".

My hosting company says I will have to manually lodge a ticket each time to have the folders deleted. THis seems like a pain in the arse. could anyone offer any help into this situation? or will this really be the case that they will have to delete the files.
The only other option I see is Bill Wadman creating some sort of script that will go in and delete the fies or folder directories for you.

View Replies !
How To Write A File As Owner =t Hat Folder
So far, I can only use php to write a file if the containing folder is either owned or grouped to "nobody" (which is what PHP runs as in my Linux server).

Then along comes "SquirrelMail" which I installed recently. With SquirrelMail, you log in with your Linux username and password to check mail. Anyone with a telnet account can log in. But I noticed the user and group of the files it creates. When you create say a new folder for mail, it saves a file in your username folder AS IF IT WAS YOU, instead of being "nobody".

Without tearing the program's code apart, how does it do that? The cool thing is, I never had to set permissions or anything.

This would really be a step forward in my programming, please let me know if you have the answer to it.

View Replies !
Change The Owner That Writes Files As
I'm looking for a way to make it so that when php writes a file, instead of writing it as 'nobody' it looks at who owns the parent directory and writes the file as that owner. Any ideas?

View Replies !
SuEXEC Only Allows Write Permission For The Owner
I want to run PHP on my Apache 2.2 machine with the permission of the VSite or user invoking the script. I do it via the kernel binfmt support and suEXEC, so my scripts run as CGI. This leads to some problems, like memory and CPU consumption for the PHP binary instead of a module, and problems when several users should edit a PHP file suEXEC only allows write permission for the owner.

View Replies !
Stop A User From Hitting Refresh And Sending A Form Over Again
Is there any way to stop a user from hitting refresh and sending a form over again after they have done it once? I've tried $_SERVER['HTTP_REFERER']; but nothing.

View Replies !
Wrong Owner And Permission When An Image Is Uploaded
I have created an image upload program that uploads an image to a specified file. However, once the file is in the directory the owner reads "www" instead of my username. So any time I try to delete or rename the file I get an "Access Denied" error. As well instead of the file permissions being -rw-r--r-- like they are supposed to, the uploaded images read -rwxr-xr-x. Is there anything I can do to correct this problem? Code:

View Replies !
Fopen/fwrite And Owner/group Settings
I Have a problem with some file writeing.

I Use fopen to create a new file, but that file gets the owner and group the same as the apache owner and group.

How can i change it so that the file gets the same owner/group as the files i upload with FTP?

View Replies !
Taking Date Of Birth From User And Sending It To A Mysql Database
i have created a form that takes a users date of birth as 3 seperate values $day $month and $year i do not know how to combine these values into a single value called $dob.
I tries using just a singal value to take the date however it did not work, even after I had formated my database.

View Replies !
PHP Processes
I have a cronjob triggering a php script that takes several minutes to accomplish. I need to prevent multiple triggering by the cronjob mulfunctioning. So I would like a clean way to know how many instances of a certain php are currently working on the server.

is there a server variable for that? if not, how do I know (via php) how many concurrent accesses are there to a certain php page? for example in mysql (the "SHOW PROCESSLIST" command), but I need a similar function for the php page iself.

View Replies !
Background Processes
I'd like to know how to send an external process to the background, so that I can run multiple instances of the same process at one time. Any tips, links.. etc?

View Replies !
Listing Processes In PHP
Using PHP, is it possible to return and display a list of currently running processes on the client's machine? In fact, is it possible to run a system command on a client's machine?

View Replies !
Automated Processes
Customers post 'projects' to my site. These 'projects' are closed after 10 days. I could run a script on the default.php page that detects this, but it seems a waste of resources to run it everytime someone visits the site. Is there a way around this, for example the first visitor to the site in any, say, 3 hour period, runs the script & switches the most recently outdated projects from open to closed?


View Replies !
Max Number Of Processes
how can i determine what the maximum number of processes i should open
with popen (or proc_open) is? i assume it'd depend on the hardware of
the computer in question, but if that were teh case, then is there a
way to get info. about it, and some general method to determine a good
number of processes to open from that info?

View Replies !
Stranded PHP Processes And ProcessExplorer
Does anyone know what it means if I see PHP processes in the process
tree at the base level, instead of under the IIS worker process?

I do nothing but web serving off of the box.

These processes that are not under the IIS worker process seem to be
stranded/hung. They are never cleaned up by any garbage collection and
I have to kill them manually. They also always have a fairly low memory
usage, potentially indicating that they fail before loading completely.

Could it be that the execution of the process fails early enough that
ProcessExplorer doesn't see them as being executed by IIS?

View Replies !
Handling Long Processes
I am building web app, that will run a long processs (image processing) that can porbably take 15-30 minutes to complete) in respond to a user request (the user clicks a "process" button on a php web form). The ideal situation that I see is once the user's request was recevied, a reply that says "you request is being processed.

we will send you email once finished", will be sent to the user, while the other process will take place. When it's finished, a callback function will be called that sends email to the user notifying him the process outcome. What are the options to implement that?
multithreading?

View Replies !
Shared Memory Between 2 Processes?
I have two running php processes (they have infinite loops) and I need them to pass some data to eachother. Writing and reading shared memory in one process works just fine but when I try to save var in process1 and read in process2 I get error: "Variable key 555 doesn't exist".

What I'm doing wrong?

//PROCESS 1 (saving var)
$key = 'My Key'
$value = 'My Value'
$app = 'lovelyapp'
$key = $key . 'a'
$segment_key = abs(crc32($app . $key));
$segment_size = 1024;
$segment_perms = 0600;
$shm_id = shm_attach($segment_key, $segment_size, $segment_perms);
shm_put_var($shm_id, 555, $value);
shm_detach($shm_id);

// PROCESS 2 (reading var)
$key = 'My Key'
$app = 'lovelyapp'
$key = $key . 'a'
$segment_key = abs(crc32($app . $key));
$segment_size = 1024;
$segment_perms = 0600;
$shm_id = shm_attach($segment_key, $segment_size, $segment_perms);
$value = shm_get_var($shm_id, 555);
shm_detach($shm_id);

View Replies !
List Processes Running In A Computer
I want to list all processes running on a computer by PHP language. Could you help me?

View Replies !
External Processes Without Waiting For Return
In php how do I call an external script or program without having php
waiting for the return?

exec and system both seem to wait for the return, I don't want this.

View Replies !
Insert Processes Before Form Is Submitted
I am trying to stop using Macromedia as my crutch and you guys have been a big help.  I need some assistance with submitting a form.  I have a form on my page and need to do an insert.  I have the action posting it back to the same page I am on versus sending it to an insert page.  The problem I am having is it trys to do the insert as soon as I pull up the page instead of waiting till the form is submitted.  I believe I need to do something with isset, but can't really find a tutorial that goes over it really well. Code:

View Replies !
Forking Multiple Processes At A Time
i have a php script that needs to execute an external php script (call this
script 2) when the user clicks a link, however I don't want the user to have
to wait until script 2 finishes executing before he sees the output of
script one... i know I can use the exec() command to do this, and use the &
to run the command in the background....

but say i want to run 100 instances of script 2 when the user clicks the
link (with different arguments)... i dont want to have all 100 processes
running at the same time... what I would like to do is run 10 or so at once,
and once those 10 are completed, run another 10...

View Replies !
Large Data Transfer Between 2 Processes
fist the context: I have a web server which query a mySql database. but
as the number of parralel queries increase, the server slows down too
much.

I got 2 ideas, one of which is to run N deamons which effectively
execute requests. the PHP uses message queuing(1) to queue queries
request to the daemons. but the answer may be quite large, larger than
messages the message queueing service can handle.

I thought to open back a communication link between the current daemon
and the waiting PHP to tranfer/process the result, using the message
queueing service to send back info regarding the opened link.

I thought to open a pipe between the current daemon and the PHP. is
this possible? and if so, how? if not, is an IP link to localhost be as
fast as a pipe?

View Replies !
Keeping Users Informed In Lengthy PHP Processes
Often PHP processes take a long time, such as wildcard searching a PostgreSQL database, or generating thumbnails.

The PHP host page does not display until the script is complete, so you can not effectively use code such as

echo "Converting file ".$Infile;
exec(convert $Infile $O8utfile);

for realtime feedback to the user.

How have others implemented a "progress meter" in PHP processes , one thought I had was to use Javascript redirection to call a PHP page with differing parameters each time .

View Replies !
Max_execution_time Ignored, Multiple Apache Processes Spawned
I have an app that is going berzerk on its own; without any code or environmental changes of any kind, for some bizarre reason it will randomly just hang, spawn multiple Apache processes and completely ignore max_execution_time, literally running infinitely.

Using PHP 5.2.0, Apache 1.3 and Win XP

Is this normal "bizarre" behavior that can occur within this setup; if so, what workarounds have you found to combat this, other than the obvious (try to debug and fix code)?

View Replies !
Limiting The Number Of Spawned MySQL Child Processes
Need to know if there is any way to limit the number of spawned MySQL child processes in linux ?

I have done my research at http://www.mysql.com and have not been able to find my answer. Have also looked at the source code (what i can understand of it).

Using MySQL v.4.0.25-max. Using an older system and the 14 childern are just bogging the system down. I am the only one with access to the server so 14 childern is overkill.

View Replies !
Checkboxes - Loop That Takes The Values And Processes And Writes The Changes To The Database.
I generate a form page from my MySQL database. let's say the table structure is:

Table A
> ID, title, active

the number of rows generated by the query is dynamic. If a field's value is 1, then the form output appears as

<input type=checkbox name=$ID checked> $title

and if not

<input type=checkbox name=$ID> $title

At the bottom of the form there is a submit button. The visitor can check/uncheck rows and then submit the form. I need to write a loop (possibly foreach) that takes the values and processes them and writes the changes to the database.

View Replies !
Sending Mail: Choice Between Sending Receipt, Or HTML Formatting
I'm using PHP's mail function to send out a message via email.

I would like for this email message to send a receipt when read as well as send an HTML formatted email. Both aspects are important to me.

I know this is a product of the mail header. This is the format I currently have:

mail(to, subject, body, "From: name <email>
Disposition-Notification-To: name<email>
Content-type:text/html;charset=utf-8");

This prompts the email program to send a reciept, but the email message is not in the HTML format, and even contains "Content-type:text/html;charset=utf-8" at the top of the body.

If I switch the order to this format:

mail(to, subject, body, "From: name <email>
Content-type:text/html;charset=utf-8
Disposition-Notification-To: name<email>");

This sends the email with HTML formatting but does not prompt the sending of the receipt. I also get "Disposition-Notification-To: name<email>" at the top of the email message.

This tells me there is a problem in the transition between the headers, which currently is "".

What am I doing wrong?

View Replies !
Build A Page That Takes Form Data, Processes It In A Second Page
I'm trying to build a page that takes form data, processes it in a second page, then sends the user to a third,depending on data processing.

On the second page, I am trying to get the page to have some sort of "Loading" message while the backend processes the data, but I can't seem to get anything to work. Does anyone know how I can get that Loading message to display?

View Replies !
Perform Redirection Of The User's Browser If The User Isn't A Valid User.
I'm running PHP on Windows, but that's just the local test... in production
it will be on Apache.

I am not using PHP as a CGI. I want to perform redirection of the user's
browser if the user isn't a valid user. I don't want to use the refresh
meta tag or javascript to do this. I want to do this with some sort of
server command.

Does anyone know how to make this work? Here's my code...
<?php
session_start();
$goal = "";
if (array_key_exists('goal', $_GET)) { $goal = $_GET['goal']; }

if (isset($HTTP_POST_VARS['userid']) && isset($HTTP_POST_VARS['password']))
{
$userid = $HTTP_POST_VARS['userid'];
$password = $HTTP_POST_VARS['password'];
$db_conn = mysql_connect('localhost', 'webauth', 'webauth');
mysql_select_db('auth', $db_conn);
$query = "select * from auth where name='$userid' and
pass=password('$password')";
$result = mysql_query($query, $db_conn);
if (mysql_num_rows($result) > 0) {
$HTTP_SESSION_VARS['valid_user'] = $userid;
}
}

View Replies !
Form Processing - Create A Form Processor With Processes The Form To A Page
I have searched the internet for this. I want to create a form processor with processes the form to a page which only certain people can access. I got everything down but the form processing. Does anyone have this code or can you lead me to the right direction?

View Replies !
User Is Verified By A MySQL Database, And Then A Session: 'user' Is Registered.
I have a problem with sessions. In my code admin.php the user is verified by a MySQL database, and then a session: 'user' is registered.

Well when the user presses a link to a another page called news.php it will be checked if the session is the same as in the same script, or if it's even registered (to prevent people trying to break in). But everytime i redirect to news.php I get a file included ip.php wich tells me Im about to break in. Code:

View Replies !
Update Based On The Type (admin/user) For A Single User
This page shows all the users in the database and the type they are (admin/user). Basically what am trying to do is update based on the type (admin/user) for a single user... and I know I need to have my UPDATE query have a WHERE statement, Code:

View Replies !
If The User Logs In, And Closes The Browser Window, How Do I Know That The User Has Logged Out.
I am creating a site that has a session based log in. Pretty simple stuff, but the bosses have asked if we can make it so that only 1 person can log into an account at once (ie if someone logs in with a specific acocunt, lock the account and dont let any one else log in)

I'v been fiddleing around with session, and various session variables etc. and the only part that I cant figure, is if the user logs in, and closes the browser window, how do I know that the user has logged out.

View Replies !
PHPmyadmin Access Denied For User 'user'@'localhost'
WinMe machine as server, with Apache 2 installed and working PHP4 installed and working ( had PHP 5.05 installed and working, but i couldnt get the mysql extensions to load - phpinfo() didnt list mysql :(, so i installed PHP4, which now lists mysql when i run phpinfo). MYSQL 4.1 installed and working. I dont know the console commands too well, but i know its working ok, cos I have used a few simple DOS prompt commands to check its alive and I can connect to the database using MyODBC frontend/driver 3.51 and also using Navicat 2004.

When i try to connect to the database via PHPmyadmin from another network PC I have an error:

#1045 - Access denied for user 'user'@'localhost' (using password: YES)

I have played around alot with different settings in the config.inc.php file.... nothing seems to work.

This almost appears to be a simple login problem ( probably is too), but I can access the database locally from the Winme machine with the username and password that wont work over the network!

I have tried not using 'localhost' as the host name but the IP address of the Winme PC but I get this error:

#1130 - Host 'MYSERVERNAME' is not allowed to connect to this MySQL server

View Replies !
Notice: Use Of Undefined Constant User - Assumed 'user'
I have a script for a shopsystem on a Linux. There it works fine.
But when I try to run it on my Windows machine, PHP says things like

Notice: Use of undefined constant dbname - assumed 'dbname' in
c:apachehtdocsaposhop estshopclassesxxx.clas s.php on line 77

On Windows I run PHP 4.3.2
On Linux runs PHP 4.3.1

View Replies !
Make A Form Where The User Can Log In And It Would Check If They Were A Valid User
i have created a user registration script where when u fill out the user name and password, it fwrites it to a txt file on the server. Now, my problem is. I would like to make a form where the user can log in and it would check if they were a valid user or if their username and password matches, how would i go about doing this.

View Replies !
Makes A User To Log Out Automatically If The User Is Inactive For 30 Minutes
im making an web-based game and im trying to make a code that makes a user to log out automatically if the user is inactive for 30 minutes, but im totally stuck on doing it.

And im also trying to make a countdown script. Example: The user is buying an item, the delivery of the item takes 2 minutes. 2 minutes later the user have the item. How do i make that in the MySQL table, and continue ticking even if the user is not logged in?

View Replies !
Access Denied For User: 'user@localhost' (Using Password: YES)
I have been trying to load a csv file into a pre-existing table but I keep getting this error: Code:

View Replies !
Redirect The Logged In User To Home.php Without Any Clicking From The User
I have this login script that calls on itself to authenticate the username and the password. It redisplays the login page if there is an error. My question is how do I redirect it to a different page, when the user is authenticated (i.e. the address in the address box changes to a new name, for example, if the login page is called login.php,.

then I want to redirect the logged in user to home.php without any clicking from the user). I realize that there is a header function available, but I've heard that any
information related to the current session is lost upon using this function. Is there any better way?

View Replies !
Authenticating User Common User Names
I want to create a password protected page with PHP and Mysql. I have 2 groups User and Admin. The respective groups have a common user/password. The user/password are stored in a database. I want to authenticate the user through a login form and not through a pop-up ($PHP_AUTH_USER) way.

What I want is, if a user logs in and he moves from one page to another, he should not be asked for validity again. Is this possible only with scripting (without session and $PHP_AUTH...). If yes - how do I keep track of an authorised user and unauthorised user, so that he should not be validated again. Does setting the user variable to global in all the pages do the trick.?

View Replies !
User Authentication And PHP Saving As Specific User.
the users of my server had to upload their pages by sftp and only the user who uploaded a page was able to edit itafterwards.

I've been asked to make a secure way for users to log on through the web and edit their pages online. However, although using .htaccess to authenticate users, the script saves as user 'nobody' and is not able to edit pages previously uploaded (and saved as user 'john_doe'). What I am trying to do is make the script save using the same username as the user used to log on.

View Replies !
Fill Fields When User Selects User From DB
I have a field with a selectbox which contains a list of client names and several other fields which display information from the DB.

I need to be able to make the fields change to the appropriate information when a user is selected from the select box. Can anybody please give me an example of a bit of code that will do this?

View Replies !
Access Denied For User 'user'@'localhost'
First time using mysql, I keep getting this error:

Access denied for user 'user'@'localhost' to database 'databaseName'


PHP Code:


$conn = mysql_connect('localhost', 'user', 'xxxxxx');
if (!$conn)
    {die('Could not connect: ' . mysql_error() . '<br>');
    }
else
    {echo 'Connection to mysql server made <br>'
    }
$db = mysql_select_db('databaseName', $conn);
if (!$db)
    {die('Cannot connect to database: ' . mysql_error() . '<br>');
    }
else
    {echo 'Connected to database'
    }

View Replies !
If Register_globals Is Turned 'off', Will USER A Display The $user ?
Scenario: User posts information to a page from a web form. USER A PHP Code:

//remember, a form POSTed information here
echo 'User is '.$user;

USER B. PHP Code:

$user = $_POST['user'];
echo 'User is '.$user;

If register_globals is turned 'off', will USER A display the $user ? If register_globals is turned 'on', will both users display $user ?

View Replies !
How Do Remove A User From MySQL.user?
How do you permanently remove a user from the MySQL database.

Delete from MySQL.user where user="Unwanted User";

just seems to ignored.

View Replies !
User Permissions - User Level 4 Or 5
I'm making a website with an admin section, and one facet of that is user management. I've made a script for this task, but I want it to be accessable only to people with user level 4 or 5. Here's the code for the script. At present, it isn't accessable to anybody, even level 4 and 5 users. Code:

View Replies !
User Authentication - Verify The User
I put the password in the database kind of like this. crypt($pwd) When I try to verify the user, I do something like this

if (crypt($pwd_user_just_entered) == $pwd_from_database)
{
//user logged in OK
}
else
{
//invalid login
}

View Replies !
How Can I Limit Access For 1 User Per User Name?
how can i limit access for 1 user per user name,so if another user tried to login using the same user name he will fail.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved