Skip to content

netzhandwerker/shared-hosting-php-cookbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

shared-hosting-php-cookbook

License: CC BY 4.0 PHP 8+

Workarounds for cheap shared PHP hosting where half the standard library is missing. Real patterns from production servers running on All-Inkl, IONOS, Strato, Hosteurope.

If you've ever seen Call to undefined function curl_init() and want to throw your laptop out the window, this cookbook is for you.

What's typically missing on shared hosting

Extension / function Common on cheap shared? Workaround chapter
curl ❌ rarely HTTPS without curl
openssl_* for streams ❌ often disabled HTTPS without curl
shell_exec, exec, passthru ❌ always disabled Replace shell calls
session_start ❌ sometimes HMAC-CSRF tokens
mbstring ❌ often Multibyte-safe UTF-8
iconv ❌ often Multibyte-safe UTF-8
filter_var ✓ usually
Zlib ✓ usually
bcmath, gmp, sodium ❌ rarely Crypto basics with hash_hmac
pcntl_* ❌ never Cron-driven background work
realpath ✓ but tricky Safe path handling

How to use this cookbook

Each recipe is a standalone Markdown file in recipes/ with:

  1. The problem — what you tried, what error you got
  2. The workaround — code that works in the absence of the extension
  3. Trade-offs — what you lose compared to the "proper" solution
  4. Real-world example — link to where this pattern is in production use

Code blocks are MIT-licensed snippets you can copy verbatim.

Recipes

Why this exists

I run Die Netzhandwerker and several sub-brands on All-Inkl shared hosting. The platform is rock-solid for €5/month but the PHP environment is stripped down: no curl, no openssl streams, no sessions, no exec. After 200+ deploys I've collected the workarounds in this cookbook.

Most of these patterns also work on IONOS, Strato, Hosteurope, and the budget tier of pretty much any European shared hosting provider.

Companion project

For full deploy automation on these constrained hosts, see shared-hosting-deploy-kit — a single-file PHP gateway that lets you push code, run snapshots, and roll back without SSH.

Contributing

Got a workaround that saved you a weekend? Open a PR. New recipes follow this template:

# Recipe NN — Title

## The problem
...

## The workaround
\`\`\`php
// minimal working code
\`\`\`

## Trade-offs
- What you lose vs. the "proper" solution

## Real-world example
- Link to production use, anonymized if needed

License

Text and explanations: CC BY 4.0 — attribute me when reusing. Code snippets in recipes/: MIT — copy and adapt freely.

Author

Daniel Wesseling — Die Netzhandwerker, Gronau (Westfalen), Germany.

About

Workarounds for cheap shared PHP hosting where half the standard library is missing. 10 recipes for All-Inkl, IONOS, Strato, Hosteurope.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors