Jump to content

Recommended Posts

Is there any possible, known, way to execute a PHP page like a process, so it doesn't display it but it runs it and does all the commands?

 

I'm making a register page and when the person registers it will send him an email and say "your email has been sent" but i don't want to wait for it to send the email so i was going to create another page which does that and execute that one, whilst displaying the "email sent" message.

Link to comment
https://forums.phpfreaks.com/topic/183686-execute-a-php-page/
Share on other sites

But then it waits for output, I don't want it to wait for output, I want it to run as a process.

 

Waits? An email should take far less than a second to be sent. PHP has no forking capabilities, the best you could attempt would be to execute a command line script in the background using exec but Iv'e not seen to many people have success with this method.

Link to comment
https://forums.phpfreaks.com/topic/183686-execute-a-php-page/#findComment-969555
Share on other sites

But then it waits for output, I don't want it to wait for output, I want it to run as a process.

 

Waits? An email should take far less than a second to be sent. PHP has no forking capabilities, the best you could attempt would be to execute a command line script in the background using exec but Iv'e not seen to many people have success with this method.

 

Well i really just want to know for future reference i know a list of call things i can do with it, such as make a program (non-PHP) that updates a website eveyr 24 hours using a php script etc. Your saying that i can exec something? What is it that i can try to execute? Thanks.

Link to comment
https://forums.phpfreaks.com/topic/183686-execute-a-php-page/#findComment-969556
Share on other sites

Aaah perfect, it works great! That's what i was looking for, the program which executes php scripts in a process, thank you very much.

 

I used "C:\xampp\php\php C:\site\tutorials\mail.php"

 

and i recieved an email from myself so it worked very well hehe. :D

 

Still, exec has to wait for the execution to finish unless you put the script into the background. No idea how to do it on windows, but in bash you use & after the command in question. It may even be the same on windows.

Link to comment
https://forums.phpfreaks.com/topic/183686-execute-a-php-page/#findComment-969569
Share on other sites

Still, exec has to wait for the execution to finish unless you put the script into the background. No idea how to do it on windows, but in bash you use & after the command in question. It may even be the same on windows.

I have this:

pclose(popen("start $command","r"));

hehe

Link to comment
https://forums.phpfreaks.com/topic/183686-execute-a-php-page/#findComment-969580
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.