jeremykendall / php-domain-parser

Public Suffix List based domain parsing implemented in PHP
MIT License
1.16k stars 128 forks source link

class "Pdp\Rules" not found with laravel 8 #346

Closed joe820912boy closed 1 year ago

joe820912boy commented 1 year ago

Pdp version: 6.2.0 PHP version: 8.1.7 OS version: Ubuntu 20.04

Here is error log [2023-01-11 10:24:07] local.ERROR: Class "Pdp\Rules" not found {"exception":"[object] (Error(code: 0): Class \"Pdp\\Rules\" not found Here is my code

use Pdp\Rules;
use Pdp\Domain;
$publicSuffixList = Rules::fromPath('/home/joe/www/laravel_project/storage/public_suffix_list.dat');
$domain = Domain::fromIDNA2008($dn);
$result = $publicSuffixList->resolve($domain);
return $result->secondLevelDomain()->toString();

I have use composer require jeremykendall/php-domain-parser:^6.0

and in autoload_static.php it could see that 'Pdp\\Rules' => __DIR__ . '/..' . '/jeremykendall/php-domain-parser/src/Rules.php',

I have test in windows platform, and it could be used, but in ubuntu, it occurs this problem,

I makesure that did the following command

php artisan route:clear
php artisan route:cache
php artisan octane:reload

Do I miss any steps to use domain parser? Or something errors in it?

joe820912boy commented 1 year ago

To prevent that forget enable intl ext, here if my loaded extension with get_loaded_extensions()

["Core","date","libxml","openssl","pcre","zlib","filter","hash","json","pcntl","Reflection","SPL","session","standard","sodium","swoole","mysqlnd","PDO","xml","bcmath","calendar","ctype","curl","dom","mbstring","FFI","fileinfo","ftp","gd","gettext","iconv","igbinary","imagick","imap","intl","exif","mysqli","pdo_mysql","Phar","posix","readline","redis","shmop","SimpleXML","soap","sockets","sysvmsg","sysvsem","sysvshm","tokenizer","xmlreader","xmlrpc","xmlwriter","xsl","zip","Zend OPcache"]

joe820912boy commented 1 year ago

Finally I found the solution. I stop the octane server, start again, and it worked.

I think the problem that reload the octane it wouldn't reflash the packages that I install?

Maybe but needs more confirm.