MikeL's FreeBSD howto - php problems

[20230928]
The php was downloading, not running on one of my secondary domains. I tried copying the script to my primary domain, and amazing, it works there...

I fooled around for hours, and suddenly it's working, and I'm not sure what this I did that fixed it. Man that pisses me off...


[20230927]
I had a lot of trouble getting PHP running on FreeBSD 12, Apache24. When I did the install, the default php was 8.3.

Bottom line is that mod_php83 is fucked. I had to remove it, and build/install mod_php82 from the port, using the gcc compiler. Instructions here:
apache24 with mod_php82 won't start up. Scroll down about halfway.
With this fix, apache will now start up with the LoadModule php_module statement, but it's still not parsing/executing php code -- sigh.


[20200328]
WARNING WARNING WARNING!
Not a php problem, but this will be a problem in your php code. As of mysql8, the PASSWORD() function has been removed. If you are using MYSQL PASSWORD, you will be completely fucked. You will want to fix your code NOW, before mysql is updated beneath you, to use an alternative mechanism for saving passwords.

[20200228]
Had to do a complete server install, including Apache/php. A few notes:

[201912]
Do NOT install from ports collection - you'll be killed by a bazillion"disable_vulnerabilites" problems.

pkg install php73
pkg install php73-session
pkg install php73-mysqli
One of my customers uses WordPress and Akeeba backup. You'll need these additional packages:
pkg install php73-zlib
pkg install php73-filter
pkg install php73-simplexml
pkg install php73-mbstring
pkg install php73-hash

One of my packages uses curl with json to communicate outbound:
pkg install php73-json
pkg install php73-curl
Apache interface:
pkg install mod_php73

Edit /usr/local/etc/php.ini

Edit /usr/local/etc/apache/http.conf
Change
LoadModule php5_module libexec/apache24/libphp5.so
to 'php7'. Mine actually had both php5 and php7 lines, but php7 was commented out. I commented it in and Apache wouldn't start. I commented out php5, so I only had php7, and all was well with the world again.

In my php code:
change:
mysql_connect() to mysqli_connect().
remove mysql_select_db() - it's parm is now the 4th parm to mysqli_connect().
The return from _connect() is now used by the mysqli_ functions, thus must now be declared as a global in every single fucking routine that uses it. I HATE PHP - PHP is shit. Ok, it's better than VBScript, but that's not saying much.
Every mysqli_query() gets a new first parm that is the connect result.
mysql_fetch_object() becomes mysqli_fetch_object(), no parms changes, yay!
mysql_real_escape_string() becomes mysqli_real_escape_string() and gets the _connect return. Why the fuck a string sanitizer needs the db connection I cannot imagine - at best, this scares me.
mysql_error() becomes mysqli_error(), needs new connect parm "link".
mysql_data_seek() becomes mysqli_data_seek(), no parms changes.


Copyright © 1995-2024 Mike Lempriere (running on host bayanus)