Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
PHP 8, MAMP, alternatives for local development
Edit by gaekwad: split from forum.textpattern.com/viewtopic.php?id=51102
FYI the latest release of MAMP now has PHP 8 bundled with it. I’ve updated my local stack.
Last edited by gaekwad (2020-12-18 12:32:48)
Offline
Re: PHP 8, MAMP, alternatives for local development
philwareham wrote #327544:
FYI the latest release of MAMP now has PHP 8 bundled with it.
Yay. Time to update. Thanks for the hint.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: PHP 8, MAMP, alternatives for local development
Getting this on PHP 8.0.0 in MAMP…

Is GD not bundled with PHP anymore in v8?
Offline
Re: PHP 8, MAMP, alternatives for local development
philwareham wrote #327547:
Is GD not bundled with PHP anymore in v8?
It’s not mentioned in the changelog. Just says they’ve added/fixed a few GD features and deprecated others. Might be a MAMP config thing.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: PHP 8, MAMP, alternatives for local development
Good catch, no more thumbnail creation and
Warning "unlink(C:\xampp\tmp\phpF4FB.tmp): No such file or directory"
in C:\xampp\htdocs\textpattern\textpattern\include\txp_image.php at line 814.
adminErrorHandler()
C:\xampp\htdocs\textpattern\textpattern\include\txp_image.php:814 unlink()
C:\xampp\htdocs\textpattern\textpattern\include\txp_image.php:64 image_insert()
C:\xampp\htdocs\textpattern\textpattern\index.php:228 include()
on image upload.
Offline
Re: PHP 8, MAMP, alternatives for local development
Yeah, thumbnail creation (awful as they are) will be affected if GD is missing – that’s expected – but we should code around that error! Nice find.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: PHP 8, MAMP, alternatives for local development
GD extension was simply disabled in php.ini in my case.
Edit and the warning has always been there, I guess, just silenced. Should be fixed now.
Offline
Re: PHP 8, MAMP, alternatives for local development
etc wrote #327551:
GD extension was simply disabled in
php.iniin my case.
Sounds like an oversight as gd 2.2.3 is listed in the components (version history). I’ll guess they’ll be adding a 6.3.1 update soon.
Aside: MAMP (Pro) had got so slow on my aging mac – sometimes taking minutes to start servers and occupying the computer every time it awoke from sleep – that I haven’t upgraded this time and have been trialling Laravel Valet. Much leaner, much quicker so far, though I haven’t got as many sites up yet as I had on MAMP. You can switch PHP versions via the command line with a simple command but the biggest difference (I won’t say disadvantage) is that it runs on nginx rather than apache so htaccess has no effect. It works well with the standard PHP driver that comes with Valet. Anyhow txp 4.8.5 appears in initial tests to work fine with PHP8 + GD with MySQL 8.
EDiT: There’s now a lightweight, native mac menu bar app that interacts with Laravel Valet. Helps you manage multiple PHP installations, locate config files and more. And it’s open source: PHP Monitor and installable via homebrew (note Big Sur or newer only though).
TXP Builders – finely-crafted code, design and txp
Offline
Re: PHP 8, MAMP, alternatives for local development
GD is compiled, just ;commented out. Removing ; in php.ini (and restarting) restores it.
Offline
Re: PHP 8, MAMP, alternatives for local development
ok. it installed just fine. I had created the DB which defaults to UTF8 , but the installation process notified that it installed the utf8mb4
$txpcfg['dbcharset'] = 'utf8mb4';
no errors
…. texted postive
Offline
Re: PHP 8, MAMP, alternatives for local development
more diagnostics from my installation:
PHP version: 8.0.0 GD Graphics Library: 2.3.0; Supported formats: GIF, JPEG, PNG, WebP. Server timezone: UTC
…. texted postive
Offline
Re: PHP 8, MAMP, alternatives for local development
I’m currently testing the dev version (latest) locally with XAMPP PC (latest with PHP 8.00).
All works fine except a plugin I use causing this error message:
A problem occurred while loading the plugin: glz_custom_fields (2.0 beta) -> 8192: Required parameter $value follows optional parameter $contents on line 1613
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
Re: PHP 8, MAMP, alternatives for local development
For robustness during setup – especially under PHP 8 – I’ve committed a patch that uses proper exception handling around mysqli_*() calls during manual setup. This removes the error suppression ‘@’ trick and will fail gracefully in the UI, while logging any errors in your PHP log file.
So please, if you would set up a Txp installation from scratch using 4.8.5-dev to stress test:
- No database connection at all
- Incorrect DB login and/or password
- Incorrect table name
- Correct table name but tables already exist
- Correct/incorrect table name with prefix that does/doesn’t already exist
then that would be ace. Please report back here if anything falls apart. You shouldn’t see any yucky PHP error messages during setup, just nicely formatted (red) error messages from Txp itself, with the real PHP-generated errors squirrelled away in your logs. Thank you.
Last edited by Bloke (2020-12-16 21:41:59)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: PHP 8, MAMP, alternatives for local development
Addendum: If anybody would like to have a go at patching txplib_db.php that would be a useful exercise. There are only two uses of ‘@’ in there: both surrounding attempted error suppressions of mysqli_num_rows() in the safe_query() and safe_field() functions.
I’m not sure how best to handle those situations with proper error handling. Maybe we need to locally turn on mysqli_report() just before the mysqli_ num_rows() calls, and then switch it off again straight after, to avoid having uncaught errors thrown around other mysqli_ calls? Then pass the return value into the subsequent calls.
Honestly, I’m not even sure I know how to simulate a failure in those two instances, but there must be some kind of avenue for them to fail because we added the error suppressions for a reason in those specific places.
Can anyone get Txp to throw an error message to the screen here in debugging mode if the ‘@’ signs are removed? I seem to recall it had something to do with the trace log dying and throwing a white screen under some circumstances. Presumably, if we can emulate the conditions under which those errors are thrown, you’ll get a white screen situation in PHP 8 because it ignores the error suppression?
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: PHP 8, MAMP, alternatives for local development
so, that did not go too well…
First step I downloaded the mamp/mamp-pro installer, which does everything possible to kick me into the mamp-pro application (the installer itself is fine, standard .pkg process – absolutely did not appreciate their attempt to shove me into mamp-pro).
After some cursing and what not, I found the non-pro mamp.app, selected php8, loaded their webstart view. accessing the phpMyAdmin page to create a DB. I was greeted with endless warning panels, luckily with a button at the top, “ignore all”. OK. I could create a TXP DB.
Now accessing the TXP site, setup. The usual steps, everything seems fine, placed a config.php file with the provided data, and finished (name, username pass…). OK. Fine ? hmm… dunno. I clicked the button that should bring me to the TXP login panel… and… it brought me right back to the start of the setup process. :-(. Next I attempted to access the login panel directly, going to /textpattern/; that of course was fine, but no way could I login with the created username and password. those were rejected.
Blood pressure in not-so-good zone… back to phpMyAdmin, try to check the DB. Every single click in there generates a truckload of warnings and possibly errors. Obviously phpMyAdmin is not PHP8 ready. Looking at the txp-user table it is possible that the user was actually not created. Checking the various error logs (Apache, PHP, MySQL), I did not see anything obvious. The PHP log was empty for the time I ran the test. No relevant apache errors, the MySQL log was too spammy for me to check.
I deleted the whole thing, mamp and all, and restarted the MBA.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline