Skip to content

Instantly share code, notes, and snippets.

@smichaelsen
Last active April 27, 2018 07:59
Show Gist options
  • Save smichaelsen/1c7403bfc50c45e3eccc50ec8907f527 to your computer and use it in GitHub Desktop.
Save smichaelsen/1c7403bfc50c45e3eccc50ec8907f527 to your computer and use it in GitHub Desktop.
Limitations of PHP's built-in web server - UPDATE: Workaround available

Since about a year we're mostly using PHP's built-in web server for TYPO3 projects.

I've posted a how-to run TYPO3 on PHP dev server with switchable PHP versions.

The built-in server "is not intended to be a full-featured web server" however it brings everything you need for running most PHP applications - including TYPO3. Yesterday I learned one of its limitations the hard way.

When trying to index a page onto a Apache Solr search server using the solr TYPO3 extension - the indexing took forever and produced timeout error messages.
After hours(!) of debugging, I found the reason: PHP's built-in web server is single threaded. That means that while it is processing one request it can not start another one.
Why is that a problem? When indexing a page the solr extension fires requests to the frontend to retreive a fully rendered page, but it can not be rendered because there's already a process running the indexer - so it gets stuck.

The problem should also affect extensions like crawler or pagepath and potentially other TYPO3 functions.

I have not found a way around it so far. If you need to index pages with the solr extension or need concurrent PHP requests for other reasons, I suggest you look for another local PHP environment.

Update: A way to get around this is to spawn a separate PHP process. E.g. I now run php -S 127.0.0.1:8082 which I use for the TYPO3 backend and php -S 127.0.0.1:8080 for the frontend. That does the trick. Thanks to Helmut for coming up with the workaround idea.

Sebastian Michaelsen
Maschinenraum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment