PHP Browscap.ini Usage
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
-
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: 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?
0 -
/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.php0 -
Yes, you'd need to call the specific PHP version used for that site for that test to be valid. 0 -
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.0 -
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? 0 -
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.0 -
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? 0 -
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.0 -
Okay, and if you run the full path to the file like this: /opt/cpanel/ea-php80/root/usr/bin/php /home/xxxx/public_html/test.php that does work? 0 -
Okay, and if you run the full path to the file like this: /opt/cpanel/ea-php80/root/usr/bin/php /home/xxxx/public_html/test.php that does work?
I edited my post, can you read and enlighten me more? Also; /opt/cpanel/ea-php80/root/usr/bin/php /usr/local/bin/php What is the difference?0 -
Let's look at the source of the files. [root@host /]# rpm -qf /usr/local/bin/php ea-php-cli-1.0.0-9.11.16.cpanel.x86_64 [root@host /]# 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# 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:0 -
Let's look at the source of the files.
[root@host /]# rpm -qf /usr/local/bin/php ea-php-cli-1.0.0-9.11.16.cpanel.x86_64 [root@host /]# 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# 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:0 -
[QUOTE="cPRex, g"nderi: 2917789, "ye: 586151"> Dosyalar?n kayna??na bakal?m. [KOD][root@host /]# rpm -qf /usr/local/bin/php ea-php-cli-1.0.0-9.11.16.cpanel.x86_64 [root@host /]# 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
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:0 -
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. 0
Please sign in to leave a comment.
Comments
15 comments