Upgrades to php installed pear and now live site down.

I have a live chat server with freebsd which I just upgraded from 13.1 to VERSION="13.4-RELEASE-p1". I run a test system and didn't realize it was 13.3 but it works fine. After the upgrade php 7.xx was not available so I installed php83 the same as my test machine and it was working but then I added more php modules to be compatible with wordpress which I run as another virtual web server under apache. Apache starts but I am now getting a pear missing error, I installed pear removed pear ... change php versions and I am at a loss and frankly panicing. I once tried to install Maia mail server years ago and got pear installed and had to rebuild from scratch! Help!

I have installed and removed php83 and associated modules and apache mod_php83 the same with mod_php84, I don't see anything in /usr/local/etc/php.ini or php.conf ... where is the darn pear getting included from? I do use php_mysqli but it works on my test machine without pear.


[Mon Oct 14 16:10:11.953918 2024] [php:error] [pid 77953] [client xxx.xxx.xxx.xx:61001] PHP Fatal error: Failed opening required '/usr/local/www/htdocs/index.php' (include_path='.:/usr/local/share/pear') in Unknown on line 0
[Mon Oct 14 15:53:14.599294 2024] [php:error] [pid 77234] [client xx.xxx.xxx.xx:58428] PHP Fatal error: Failed opening required '/usr/local/www/htdocs/phpinfo.php' (include_path='.:/usr/local/share/pear') in Unknown on line 0

I even tried just a phpinfo file see above error

I have installed pear as well, pkg install php83-pear and do get an error

The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
php83-pear: 1.10.13

Number of packages to be installed: 1

The process will require 2 MiB more space.

Proceed with this action? [y/N]: y
[1/1] Installing php83-pear-1.10.13...
[1/1] Extracting php83-pear-1.10.13: 100%
PHP Warning: Trying to access array offset on false in /usr/local/share/pear/PEAR/DependencyDB.php on line 173
PHP Warning: Trying to access array offset on false in /usr/local/share/pear/PEAR/DependencyDB.php on line 177
PHP Warning: Trying to access array offset on null in /usr/local/share/pear/PEAR/DependencyDB.php on line 177

I would rather just not have pear, my test system works without it

this works
root@superbee:~/notes# php -v
PHP 8.3.8 (cli) (built: Jul 9 2024 02:02:25) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.8, Copyright (c) Zend Technologies

root@superbee:~/notes# php -m
[PHP Modules]
bz2
Core
ctype
date
filter
gd
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
random
Reflection
session
SPL
standard
xml
xmlwriter
zip
zlib

This does not work .. I did install all the same modules but with or witthout I get the pear error
PHP 8.3.12 (cli) (built: Oct 8 2024 02:30:31) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.12, Copyright (c) Zend Technologies
php -m
[PHP Modules]
bz2
Core
ctype
date
filter
gd
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
random
Reflection
session
SPL
standard
xml
xmlwriter
zip
zlib

[Zend Modules]




Help again. Thanks in advance..
 
[Mon Oct 14 15:53:14.599294 2024] [php:error] [pid 77234] [client 63.142.204.37:58428] PHP Fatal error: Failed opening required '/usr/local/www/htdocs/phpinfo.php' (include_path='.:/usr/local/share/pear') in Unknown on line 0

Is this error telling you that it can't open the PHP file? Are the paths correct?

Don't panic, deep breath, slow down, if this is just about turning off the PEAR extension it should be OK. FreeBSD 13.x, PHP 8.2, mod_php are all fine and rock solid (I've not tried 8.3 yet) so this is fixable.
 
I have an intranet site I run off wordpress and it has the following php setup...

Code:
mod_php83 php83 php83-bz2 php83-ctype php83-curl php83-dba php83-dom php83-exif php83-fileinfo php83-filter php83-gd php83-gettext php83-iconv php83-imap php83-intl php83-mbstring php83-mysqli php83-opcache php83-pcntl php83-pdo php83-pdo_mysql php83-pdo_sqlite php83-pear php83-pear-DB php83-pear-File_Archive php83-pear-MIME_Type php83-pecl-APCu php83-pecl-imagick php83-pecl-mcrypt php83-pecl-memcache php83-pecl-memcached php83-pecl-xmlrpc php83-phar php83-posix php83-pspell php83-readline php83-session php83-simplexml php83-sockets php83-sqlite3 php83-tokenizer php83-xml php83-xmlreader php83-xmlwriter php83-zip php83-zlib

Code:
root@IntraNet:/root# php -m
[PHP Modules]
apcu
bz2
Core
ctype
curl
date
dba
dom
exif
fileinfo
filter
gd
gettext
hash
iconv
imagick
imap
intl
json
libxml
mbstring
mcrypt
memcache
memcached
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
pspell
random
readline
Reflection
session
SimpleXML
sockets
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache


Code:
root@IntraNet:/root# php -v
PHP 8.3.12 (cli) (built: Oct  8 2024 12:06:27) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.12, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.12, Copyright (c), by Zend Technologies

There's probably a lot of cruft in there, but at least it works and I don't mess with it.
 
php73 is eol

Also, you quote a lot of extensions and modules in your setup and from the freshports listing for pear...

Description PEAR is a framework and distribution system for reusable PHP components.PEAR is short for "PHP Extension and Application Repository" and is pronounced just like the fruit. The purpose of PEAR is to provide: - A structured library of open-sourced code for PHP users - A system for code distribution and package maintenance - A standard style for code written in PHP - The PHP Extension Community Library (PECL)

You want extensions, so blaming pear is non sequitar imho...
 
I have installed and removed php83 and associated modules and apache mod_php83 the same with mod_php84
As you previously had mod_php7?, check to make sure it's been removed and you have the appropriate mod_php8? installed. The upgrade of the packages will replace php76 with php82 but won't replace mod_php76 with mod_php82.
 
Hiya SirDice & Team

Thanks, I solved the problem this morning, maybe I just needed to walk away for a bit. Yep I restarted the server, yeah I found where to change mod_phpxx and the corresponding lib in httpd.conf files. I don't use pear so don't want to load it if I don't need it, but that was not the problem. Yesterday I wrote a few lines and put DirectoryIndex with index.html first with some links so people could get into the chat with that page. This morning I started looking at the error logs for both https and http (I run them separately) and apache also saying it couldn't access files, like image files too. Went and checked and what what do you know, all my web server files were owned root:wheel mode 640 not 644, and the directories were 750 not 755. I changed that and my Hello world test.php worked and then again put DirectoryIndex index.php first and I am back in business. Probably 640 with root:www would be a more secure but in theory no one else has access to the server, will think about that a bit.

It does leave me wondering how file permissions got changed in /usr/local/www/htdocs and /usr/local/www/phplibs (my own libs) during the upgrade when I don't think that is even the default location for an apache install anymore. Also strange it generated a pear error.... no idea.

Updated: I now suspect I ran the following (eg in the main htdocs directory not the wordpress directory) but not the corresponding chown -R www:www htdocs
find /usr/local/www/htdocs -type d -exec chmod 750 {} \;
find /usr/local/www/htdocs -type f -exec chmod 640 {} \;

Should have been
find /usr/local/www/vdomain/htdocs -type d -exec chmod 750 {} \;
find /usr/local/www/vdomain/htdocs -type f -exec chmod 640 {} \;

That would explain the mode change without the owner change.

Thanks everyone for the support and tips.

John
 
Back
Top