PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, July 22, 2022

[FIXED] How do I run PHP's built-in web server in the background?

 July 22, 2022     daemon, php, php-5.4, protractor     No comments   

Issue

I've written a PHP CLI script that executes on a Continuous Integration environment. One of the things it does is it runs Protractor tests.

My plan was to get the built-in PHP 5.4's built-in web server to run in the background:

php -S localhost:9000 -t foo/ bar.php &

And then run protractor tests that will use localhost:9000:

protractor ./test/protractor.config.js

However, PHP's built-in web server doesn't run as a background service. I can't seem to find anything that will allow me to do this with PHP.

Can this be done? If so, how? If this is absolutely impossible, I'm open to alternative solutions.


Solution

You could do it the same way you would run any application in the background.

nohup php -S localhost:9000 -t foo/ bar.php > phpd.log 2>&1 &

Here, nohup is used to prevent the locking of your terminal. You then need to redirect stdout (>) and stderr (2>).



Answered By - Devon
Answer Checked By - Timothy Miller (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing