Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2020-12-16 21:40:33

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

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.

Txp Builders – finely-crafted code, design and Txp

Offline

#14 2020-12-16 21:59:52

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

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.

Txp Builders – finely-crafted code, design and Txp

Offline

#15 2020-12-17 06:55:20

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,196
Website

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

Offline

#16 2020-12-17 08:40:18

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,196
Website

Re: PHP 8, MAMP, alternatives for local development

PS – one thing i might have added; I had installed Sandspace theme in the Admin themes folder; it, of course, appeared for selection in the last set up panel, and I, of course…selected it. when accessing the login panel, the Hive theme was in use. I don’t remember that happened under PHP 7.4 and 7.3.

That is another indication that stuff might not have been registered in the mamp DB (MySQL 5.7.x).


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#17 2020-12-17 08:41:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

Re: PHP 8, MAMP, alternatives for local development

That sounds like a frustrating experience. Very odd that the end of the installation process kicked you back to the start of setup. I’ve not experienced that here, but I haven’t “upgraded” MAMP yet so I’m still on some minimum version of PHP 5 for testing purposes.

I agree I don’t like the way MAMP keeps trying to give you “free” MAMP-Pro trials and sneaking you into the premium product. But it does rather sound like MAMP and its supporting apps aren’t as battle ready for PHP 8 as they think.

EDIT: Does MAMP misbehave in the same way if you switch back to PHP 7.4?

Last edited by Bloke (2020-12-17 08:42:50)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#18 2020-12-17 08:49:02

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,196
Website

Re: PHP 8, MAMP, alternatives for local development

Bloke wrote #327573:

But it does rather sound like MAMP and its supporting apps aren’t as battle ready for PHP 8 as they think.

Yes, I had just started drafting an additional post noting that.

I think Mamp is a fine product, kudos for 1/ fairly good, readable documentation (comprehensive, I think), and 2/ correct use of the .pkg installer.

All testing was done on macOS 11.1 on the battle tested MBA.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#19 2020-12-17 22:40:58

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,729
Website

Re: PHP 8, MAMP, alternatives for local development

phiw13 wrote #327569:

First step I downloaded the mamp/mamp-pro installer, which does everything possible to kick me into the mamp-pro application …

Bloke wrote #327573:

I agree I don’t like the way MAMP keeps trying to give you “free” MAMP-Pro trials and sneaking you into the premium product. But it does rather sound like MAMP and its supporting apps aren’t as battle ready for PHP 8 as they think.

FWIW: Even though I’m attempting to move away from it (it’s got slow but then again my Mac is nearly 10 years old), MAMP Pro does make handling things a lot easier on a per-site basis than the bare MAMP. You can set up multiple hosts with different PHP versions, apache or nginx, with or without local certificates all with a few clicks. Great if you’re upgrading a site to get over the php 5.6->7 hump. You can put the sites where you want on your Mac and if you use the same setup often, you can also start from a standard folder setup. Mailhog to catch outgoing local web server email is also useful, as is the ability to do mobile testing on a local network. You can do those things manually, of course, or add another hosts file manager on top of MAMP but the Pro version makes that a whole lot easier in an integrated system. I’m not defending their method of pushing their product, but I don’t regret having paid for it in the past.

As mentioned earlier, I’m trying Laravel Valet for now and it’s working nicely so far, but it’s nginx only so no Apache modules and no htaccess (clean urls work fine, though). It sits on top of homebrew and composer so requires some command-line use to get set up or to switch PHP versions but thereafter one only really needs Sequel Ace to manage mysql. If I find I can’t do without htaccess or absolutely need per-site php switching, then I may go back to MAMP.


TXP Builders – finely-crafted code, design and txp

Offline

#20 2020-12-18 01:03:05

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,092
Website Mastodon

Re: PHP 8, MAMP, alternatives for local development

i have Mamp Pro 5.7 and it was worth the price when i had to manage a number of sites. Now i hardly ever use it as i do all my testing on a live server. i just use a dormant domain. Then deploy to the live one.
(ps i am constantly implored to update to version 6.0, which i ignore)


…. texted postive

Offline

#21 2020-12-18 10:18:36

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,196
Website

Re: PHP 8, MAMP, alternatives for local development

Jacob, I opened a discussion on possible options to install local dev. environment here.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#22 2020-12-18 10:53:04

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,263
GitHub

Re: PHP 8, MAMP, alternatives for local development

jakob wrote #327586:

(it’s got slow but then again my Mac is nearly 10 years old)

Aside: I love how many folks around here have vintage Macs that just keep on going. Brilliant.

Offline

#23 2020-12-18 11:24:28

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

Re: PHP 8, MAMP, alternatives for local development

gaekwad wrote #327601:

I love how many folks around here have vintage Macs that just keep on going.

Me too!

Mid-2012 MBP upon which I type this, “dead” according to the genius bar, lovingly stripped back to the motherboard and resurrected by me over many hours using a toothbrush and water to remove the spilled gin and tonic.

Sure, it’s had a few pimps – 16GB RAM, SSD+HDD internal caddy in place of the Superdrive, and I’m on my second (soon third, I expect) keyboard. Plus, Pete’s helped me out with immense knowledge regarding fixing things like the SATA cable when the machine went wonky recently. But damn, the i5 Mac still outperforms my desktop Windows 10 PC with its quad core Intel CPU and crunjo Nvidia GT Gfx card.

That’s why the newer breed of ‘throwaway’ Macs with unreplaceable/unupgradeable parts make no sense to me as a hacker and fixer-upper. I don’t throw nuthin’ away unless it’s way beyond repair (and even then I’ll harvest it for bits, just in case… and that’s saved my bacon more than once).

Anyway, sorry, carry on.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#24 2020-12-18 11:25:29

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,729
Website

Re: PHP 8, MAMP, alternatives for local development

gaekwad wrote #327601:

Aside: I love how many folks around here have vintage Macs that just keep on going. Brilliant.

Agree but I am careful with it and it is still in pretty good shape. My work colleagues have gone through 2-3 windows laptops in the same period and mine is still quieter. But its days are numbered: while there’s no hurry to update to a newer OS, it can’t go beyond Catalina (or not without tricks).


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB