Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

(Solved) PHP Isn't Playing With Apache2

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
8 posts • Page 1 of 1
Author
Message
67comet
Apprentice
Apprentice
User avatar
Posts: 262
Joined: Fri Oct 29, 2004 9:48 pm
Location: Ogden, UT
Contact:
Contact 67comet
Website

(Solved) PHP Isn't Playing With Apache2

  • Quote

Post by 67comet » Thu Aug 12, 2021 5:58 pm

Hello,

I'm working on a server that I do not have physical access to (ssh in from my location). It is an older 32bit computer (thus my love for Gentoo grows).

I installed Wordpress (It's my go-to for my friends that want to run their own servers out of their homes).

Gentoo and me haven't played with each other in quite some time, but I don't remember it being this difficult to get LAMP up and running.

I've got MySql working (Nextcloud is working), Apache2 seems to be fine, but PHP doesn't seem to be talking to Apache or visa-versa.

I followed the LAMP wiki and it all seemed fine, but when I head to her site, it just tells me "There's been a critical error" with no other information to chase down.

When I check: php -v it gives me PHP 7.4.21 (cli).
apache2ctl -M shows: php7_module (shared)

What am I missing? My vhost file seems to be fine (very similar to the ones I use for my sites at home (Ubuntu Server 21.04).

I looked in /var/log/apache for the error logs, and it looks like Wordpress is looking for PHP but it's not doing what it is asking (I don't understand it all, and I can paste it in here, but there's quite a bit).

Here is the tail results (there's more, this is the first part):

Code: Select all

Thu Aug 12 16:00:37.309417 2021] [php7:error] [pid 3236] [client 114.119.134.35:8996] PHP Fatal error:  require(): Failed opening required 'ABSPATHWPINC/sodium_compat/autoload.php' (include_path='.:/usr/share/php7:/usr/share/php') in /var/www/www.watchingskycandy.com/wordpress/wp-includes/compat.php on line 333
The file in question (Line 333) has:

Code: Select all

 // sodium_crypto_box() was introduced in PHP 7.2.
if ( ! function_exists( 'sodium_crypto_box' ) ) {
        require ABSPATH . WPINC . '/sodium_compat/autoload.php';
}
Any help is appreciated,
Thank you
Last edited by 67comet on Fri Aug 13, 2021 5:16 pm, edited 1 time in total.
A Pile of Code (basically dead).
Personal Site (basically useless).
Top
alamahant
Advocate
Advocate
Posts: 4032
Joined: Sat Mar 23, 2019 12:12 pm

  • Quote

Post by alamahant » Thu Aug 12, 2021 7:05 pm

Hi
In /etc/conf.d/apache2
do you have php enabled

Code: Select all

APACHE2_OPTS="..........-D PHP.........."
Possibly also fcgi and/or php-fpm depending on how you configured apache.
Also what is the output of

Code: Select all

cat /etc/apache2/mo*/70_mod_php.conf
You also need to be mindful as to what user is php running as and the perms of the webroot directory to allow access to that user.
:)
Top
figueroa
Advocate
Advocate
User avatar
Posts: 3032
Joined: Sun Aug 14, 2005 8:15 pm
Location: Edge of marsh USA
Contact:
Contact figueroa
Website

  • Quote

Post by figueroa » Fri Aug 13, 2021 3:56 am

PHP in make.conf?

Code: Select all

$ grep PHP /etc/portage/make.conf
PHP_TARGETS="php7-4"
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi -wayland
Top
hdcg
Tux's lil' helper
Tux's lil' helper
Posts: 122
Joined: Sun Apr 07, 2013 8:30 am

  • Quote

Post by hdcg » Fri Aug 13, 2021 5:01 am

Hi 67comet,

your PHP is already working. Actual problem is the code or more likely it's configuration.

Code: Select all

Thu Aug 12 16:00:37.309417 2021] [php7:error] [pid 3236] [client 114.119.134.35:8996] PHP Fatal error:  require(): Failed opening required 'ABSPATHWPINC/sodium_compat/autoload.php' (include_path='.:/usr/share/php7:/usr/share/php') in /var/www/www.watchingskycandy.com/wordpress/wp-includes/compat.php on line 333
PHP is running, but fails to include the mentioned file 'ABSPATHWPINC/sodium_compat/autoload.php'. I guess the variables ABSPATH WPINC are undefined and therefore PHP considers them as strings (most likely there is a PHP warning in the log that this is happening) and creates the invalid path.

Next step is to understand why they are not defined. They look like WordPress variables.

Best Regards,
Holger
Top
67comet
Apprentice
Apprentice
User avatar
Posts: 262
Joined: Fri Oct 29, 2004 9:48 pm
Location: Ogden, UT
Contact:
Contact 67comet
Website

  • Quote

Post by 67comet » Fri Aug 13, 2021 4:26 pm

alamahant wrote:Hi
In /etc/conf.d/apache2
do you have php enabled

Code: Select all

APACHE2_OPTS="..........-D PHP.........."
Yes, it's in there.
Possibly also fcgi and/or php-fpm depending on how you configured apache.
Also what is the output of

Code: Select all

cat /etc/apache2/mo*/70_mod_php.conf
Here's what it has:

Code: Select all

IfDefine PHP>
        # The mod_php.so symlink is controlled by
        # eselect-php. However, the module name changed from
        # php5_module to php7_module so we can't blindly load whatever
        # is there. Instead we let eselect-php manage a small
        # configuration file that loads the appropriate module.
        Include "/var/lib/eselect-php/mod_php.conf"

        # Tell apache that mod_php should handle PHP files.
        #
        # NOTE: Avoiding AddHandler/AddType for security (bug
        # #538822). Please read the related news item!
        <FilesMatch "\.(php|php[57]|phtml)$">
                SetHandler application/x-httpd-php
        </FilesMatch>

        # PHP source files which are meant to be displayed as
        # syntax-highlighted source code.
        #<FilesMatch "\.phps$">
        #        SetHandler application/x-httpd-php-source
        #</FilesMatch>

        #DirectoryIndex index.php index.phtml   

#<FilesMatch "\.(php|php[57]|phtml)$">
                #SetHandler application/x-httpd-php
        #</FilesMatch>

        # PHP source files which are meant to be displayed as
        # syntax-highlighted source code.
        #<FilesMatch "\.phps$">
        #       SetHandler application/x-httpd-php-source
        #</FilesMatch>

        DirectoryIndex index.php index.phtml
</IfDefine>
You also need to be mindful as to what user is php running as and the perms of the webroot directory to allow access to that user.
Not sure what it's running as, I didn't mess with it other than to re-emerge it a few times hoping it'd "fix its self".

Thank you.
A Pile of Code (basically dead).
Personal Site (basically useless).
Top
Banana
Advocate
Advocate
User avatar
Posts: 2379
Joined: Fri May 21, 2004 12:02 pm
Location: Germany
Contact:
Contact Banana
Website

  • Quote

Post by Banana » Fri Aug 13, 2021 4:26 pm

hdcg is correct.

I think there is something messed up with your wordpress installation since ABSPATH and WPINC is defined by wordpress itself
https://github.com/WordPress/WordPress/ ... p-load.php
Have a look here at the compat file: https://github.com/WordPress/WordPress/ ... compat.php
It should look like this:

Code: Select all

// sodium_crypto_box() was introduced in PHP 7.2.
if ( ! function_exists( 'sodium_crypto_box' ) ) {
	require ABSPATH . WPINC . '/sodium_compat/autoload.php';
}
ABSPATH and WPINC are two definitons and not one as seen in your error message: ABSPATHWPINC

PS:
I'm not a wordpress expert and will never be, I just understand PHP ;-)

EDIT:
Just saw you posted the method already.
Make sure you have the requested file: https://github.com/WordPress/WordPress/ ... toload.php
Some google foo tells me that your wordpress install is missing some files. If you can login there should be an update which can fix it. Also a manuall download of the same version and upload to the server could solve it.
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Top
67comet
Apprentice
Apprentice
User avatar
Posts: 262
Joined: Fri Oct 29, 2004 9:48 pm
Location: Ogden, UT
Contact:
Contact 67comet
Website

  • Quote

Post by 67comet » Fri Aug 13, 2021 5:16 pm

figueroa wrote:PHP in make.conf?

Code: Select all

$ grep PHP /etc/portage/make.conf
PHP_TARGETS="php7-4"
My make.conf does have php in there under the USE flag, and I un-hashtagged the PHP_TARGETS line.. Recompiled --newuse (world) and php works when I make a simple phpinfo page, but it croaks when I get to the installation of Wordpress (From their download - after I enter the database stuff, it croaks w/no good info - I'll go hit their forums up), looks like this is a Wordpress issue, not a Gentoo issue ( I'm happy about that ) ..

Thank you all again! :)
A Pile of Code (basically dead).
Personal Site (basically useless).
Top
figueroa
Advocate
Advocate
User avatar
Posts: 3032
Joined: Sun Aug 14, 2005 8:15 pm
Location: Edge of marsh USA
Contact:
Contact figueroa
Website

  • Quote

Post by figueroa » Fri Aug 13, 2021 5:33 pm

As a USE flag, php has very limited application.

Code: Select all

$ euse -i php
global use flags (searching: php)
************************************************************
[-      ] php - Include support for the PHP language

local use flags (searching: php)
************************************************************
[-      ] php
    kde-apps/umbrello: Enable PHP import support using dev-util/kdevelop 
    and dev-util/kdevelop-pg-qt
        [-  ] (5) 21.04.3 [gentoo]
        [-  ] (5) 21.08.0 [gentoo]
Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi -wayland
Top
Post Reply

8 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic