Operating System & Version
Centos 7
cPanel & WHM Version
11

coinanalyzers

Member
Apr 13, 2022
8
0
1
Turkey
cPanel Access Level
Root Administrator
I'm trying to use the PHP browscap module.

I made the following addition via MultiPHP INI Editor.

[browscap]
browscap = "/browscap.ini"

I'm putting the file in the top directory on the server. It works on my sites however. Fails on cron-executed php files.

[13-Apr-2022 23:46:01] PHP Fatal error: Unable to start standard module in Unknown on line 0
[13-Apr-2022 23:47:01] PHP Warning: Cannot open "/browscap.ini" for reading in Unknown on line 0

Coming to my question, in which directory exactly should this "browscap.ini" file be? So in which directory is it being searched?

SYSTEM INFO

cpanel_and_whm: 11.100.0
operating_system_name: centos
operating_system_version: 7
 
Last edited by a moderator:

coinanalyzers

Member
Apr 13, 2022
8
0
1
Turkey
cPanel Access Level
Root Administrator
Hey there! The actual .ini files are stored in the following directory on the system:

/opt/cpanel/ea-php##/root/etc/php.d/

where "##" is the specific PHP version you're working with. There are some additional details on this process here: Install custom PHP extension in PHP 7.3


There is something wrong with what you said or what I did.

I added the following code to the PHP 8.0 ini file.

[browscap]
; PHP: Runtime Configuration - Manual
browscap = "browscap.ini"

But the file works in the top directory ( the server's top root directory ) and on sites ? However;

/usr/local/bin/php /home/xxxx/public_html/test.php

Cannot find module in above cron command.

Also, if /opt/cpanel/ea-php80/root/etc/php.d/ is searched in this path, how does it work on sites now?
 

quietFinn

Well-Known Member
Feb 4, 2006
1,653
329
438
Finland
cPanel Access Level
Root Administrator
/usr/local/bin/php /home/xxxx/public_html/test.php

Cannot find module in above cron command.
Does it work if you do:
/opt/cpanel/ea-php80/root/usr/bin/php /home/xxxx/public_html/test.php
 
  • Like
Reactions: cPRex

coinanalyzers

Member
Apr 13, 2022
8
0
1
Turkey
cPanel Access Level
Root Administrator
Yes, you'd need to call the specific PHP version used for that site for that test to be valid.
Why didn't you answer my question? About paths and why it works on sites and not in cron?

I also tried it, the default php version of the system was already 8.

You say /opt/cpanel/ea-php80/root/etc/php.d/ should be here, but how does the module work on sites when it is in the top directory?

I'm asking for information about the way php.ini should be and my questions.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
10,433
1,635
363
cPanel Access Level
Root Administrator
I'm sorry if there was any confusion - I thought that was the answer the question, as calling /usr/local/bin/php is different than the direct call to /opt/cpanel/ea-php80/root/usr/bin/php.

I'm also not completely sure what you mean by "top directory" - are you referring to a PHP file in /home/user vs /home/user/public_html?
 

coinanalyzers

Member
Apr 13, 2022
8
0
1
Turkey
cPanel Access Level
Root Administrator
I'm sorry if there was any confusion - I thought that was the answer the question, as calling /usr/local/bin/php is different than the direct call to /opt/cpanel/ea-php80/root/usr/bin/php.

I'm also not completely sure what you mean by "top directory" - are you referring to a PHP file in /home/user vs /home/user/public_html?

I am sorry my english is not very good. I'm using translate.

I put the browscap.ini file in the / directory, one above the root folder, that is, the first home directory.

But since you said /opt/cpanel/ea-php80/root/etc/php.d/ I need to put it here. So how does it work now?

The answers I need to get;

Where to look for the file if browscap = "browscap.ini" is specified like this? Obviously, it is not searched in the place you said because the file is now in the directory I specified. I can use the module to login to sites with normal http. But when cronjobla is run it cannot detect the module.

Why should I specify the php version in the cronjob command? My system default php version is already 8. After all, I tried it and it didn't work.

We need to unravel the complexity here.
 

coinanalyzers

Member
Apr 13, 2022
8
0
1
Turkey
cPanel Access Level
Root Administrator
Just to confirm, the website works well and you see this listed in the PHP info page, but it's just not working in PHP files executed with cron. Is that correct?

Yes it works on real logins. But when run with cron it generates an error_log.

Also wget works successfully as https://....

This error occurs in the /usr/local/bin... command.

And please answer my index etc questions.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
10,433
1,635
363
cPanel Access Level
Root Administrator
Let's look at the source of the files.

Code:
[[email protected] /]# rpm -qf  /usr/local/bin/php
ea-php-cli-1.0.0-9.11.16.cpanel.x86_64
[[email protected] /]# rpm -qf  /opt/cpanel/ea-php80/root/usr/bin/php
ea-php80-php-cli-8.0.17-1.2.5.cpanel.x86_64
and also the file itself

Code:
# ll /usr/local/bin/php
-rwxr-xr-x 1 root root 933 Apr  7 15:48 /usr/local/bin/php
This shows us that /usr/local/bin/php is just a generic PHP interpreter. It doesn't interact with any of the PHP modules on the machine, and isn't a link to the default version chosen in WHM >> MultiPHP Manager.

We have some more details on this here:


Does that help clear things up?
 
  • Like
Reactions: Spirogg

coinanalyzers

Member
Apr 13, 2022
8
0
1
Turkey
cPanel Access Level
Root Administrator
Let's look at the source of the files.

Code:
[[email protected] /]# rpm -qf  /usr/local/bin/php
ea-php-cli-1.0.0-9.11.16.cpanel.x86_64
[[email protected] /]# rpm -qf  /opt/cpanel/ea-php80/root/usr/bin/php
ea-php80-php-cli-8.0.17-1.2.5.cpanel.x86_64
and also the file itself

Code:
# ll /usr/local/bin/php
-rwxr-xr-x 1 root root 933 Apr  7 15:48 /usr/local/bin/php
This shows us that /usr/local/bin/php is just a generic PHP interpreter. It doesn't interact with any of the PHP modules on the machine, and isn't a link to the default version chosen in WHM >> MultiPHP Manager.

We have some more details on this here:


Does that help clear things up?
Thank you, I will try and let you know.
 

coinanalyzers

Member
Apr 13, 2022
8
0
1
Turkey
cPanel Access Level
Root Administrator
Dosyaların kaynağına bakalım.

[KOD][[email protected] /]# rpm -qf /usr/local/bin/php
ea-php-cli-1.0.0-9.11.16.cpanel.x86_64
[[email protected] /]# rpm -qf /opt/cpanel/ea-php80/root/usr/bin/php
ea-php80-php-cli-8.0.17-1.2.5.cpanel.x86_64[/KOD]

ve ayrıca dosyanın kendisi

[KOD]# ll /usr/local/bin/php
-rwxr-xr-x 1 kök kök 933 7 Nisan 15:48 /usr/local/bin/php[/CODE]

Bu bize /usr/local/bin/php'nin sadece genel bir PHP yorumlayıcısı olduğunu gösterir. Makinedeki PHP modüllerinin hiçbiri ile etkileşime girmez ve WHM >> MultiPHP Manager'da seçilen varsayılan sürüme bir bağlantı değildir.

Bununla ilgili biraz daha detayımız var:


Bu, işleri netleştirmeye yardımcı olur mu?
[/ALINTI]

Yes, things are resolved, but I still did not get an answer to one of my questions. :)

You said the module is searched here /opt/cpanel/ea-php80/root/etc/php.d/. But how does it work even though my .ini file is not here?

browscap = "browscap.ini"

If the file is in the root directory of the server "/";

If I can get an answer to this, I'm in a good day.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
10,433
1,635
363
cPanel Access Level
Root Administrator
If the ini file isn't in the php.d directory, I wouldn't expect it to work. A file placed in the / of the server isn't getting read by PHP.

It might be best for us to examine your system directly if you could submit a ticket to our support team.