partkeepr / PartKeepr

Open Source Inventory Management
http://www.partkeepr.org
GNU General Public License v3.0
1.38k stars 400 forks source link

PHP7 support #521

Closed MarekPikula closed 8 years ago

MarekPikula commented 8 years ago

Are there plans to support PHP7?

Drachenkaetzchen commented 8 years ago

Yes, absolutely. I haven't tried PartKeepr with PHP7 yet, but if you do, please report issues if you find problems.

MarekPikula commented 8 years ago

When I'm trying to open PartKeepr after upgrade I get error:

[Sat Dec 05 21:42:56.875217 2015] [:error] [pid 28404] [client 91.234.127.59:54775] PHP Fatal error:  Uncaught Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException: Circular reference detected for service "fos_user.user_manager", path: "sensio_framework_extra.security.listener -> security.authorization_checker -> security.authentication.manager -> security.user.provider.concrete.chain_provider -> fos_user.user_provider.username -> fos_user.user_manager -> api.hydra.listener.request_exception -> serializer -> api.iri_converter -> api.mapping.class_metadata_factory -> validator -> validator.builder". in /home/admin/web/inv.marek.pikula.co/partkeepr/app/bootstrap.php.cache:2129\nStack trace:\n#0 /home/admin/web/inv.marek.pikula.co/partkeepr/app/cache/prod/appProdProjectContainer.php(9668): Symfony\\Component\\DependencyInjection\\Container->get('fos_user.user_m...')\n#1 /home/admin/web/inv.marek.pikula.co/partkeepr/app/bootstrap.php.cache(2155): appProdProjectContainer->getValidator_BuilderService()\n#2 /home/admin/web/inv.marek.pikula.co/partkeepr/app/cache/prod/appProdProjectContainer.php in /home/admin/web/inv.marek.pikula.co/partkeepr/app/bootstrap.php.cache on line 2129

Setup script tells me that

opcache.load_comments must be on
The php.ini opcache.load_comments directive must be set to 1.

whereas I have it enabled.

There is also warning:

PHP APCu cache not found
For best performance install the PHP APCu cache

but I have it installed.

Drachenkaetzchen commented 8 years ago

Can you send me the relevant output from your phpinfo.php page regarding opcache.load_comments?

MarekPikula commented 8 years ago

Here you have it: http://marpirk.net/phpinfo.php It seems like opcache.load_comments have been removed in PHP7: https://github.com/doctrine/annotations/pull/59 I have php-doctrine-annotations in version 1.2.7, so it should work (PHP7 compatibility was fixed in 1.2.5).

Drachenkaetzchen commented 8 years ago

Setup now ignores checking for the opcache.save_comments and opcache.load_comments settings if PHP7 or higher is detected.

Regarding APC: Your phpinfo.php file does not show the presence of APC.

I just upgraded my development machine to PHP7, with the fix for the setup it seems to work fine here.

MarekPikula commented 8 years ago

I installed php7 from another repo with APCu. Now at Warming up cache:

Warning: apc_clear_cache() expects exactly 1 parameter, 0 given
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Drachenkaetzchen commented 8 years ago

Sounds that your PHP installation is broken somehow. The documentation for apc_clear_cache clearly states that a parameter is optional. Which distribution are you running? If Debian, try the dotdeb PHP7 repository.

MarekPikula commented 8 years ago

CentOS Linux release 7.1.1503 (Core) with remi repo for PHP7

Drachenkaetzchen commented 8 years ago

Well as I don't have CentOS at hand and don't have the time to debug that, you could simply continue without APC support.

MarekPikula commented 8 years ago

I have APCu in 5.1.0 version, so I don't know if it's revelant to this version.

Drachenkaetzchen commented 8 years ago

Maybe it's a bug in the documentation of APCu or a bug in APCu itself. I recommend continuing without APC.

MarekPikula commented 8 years ago

It's working :smile:

Drachenkaetzchen commented 8 years ago

Perfect! With our without APC?

MarekPikula commented 8 years ago

For now without APCu. I'll tinker with it tho.

Drachenkaetzchen commented 8 years ago

Ok, I for myself can't test APCu with PHP7 yet as there are no packages yet and I can't be bothered to compile it manually right now ;) It would be cool if you have feedback, I'll leave the issue open

MarekPikula commented 8 years ago

There are packages. My configuration is like I've written before: CentOS 7 with remi-php70 repository (php-pecl-apcu)

Drachenkaetzchen commented 8 years ago

Sorry, I meant no packages for APCu on Debian. I'm developing on Debian and I have only basic knowledge of other distributions, so it would be pretty time-consuming for me to setup APCu manually or on another distribution.

MarekPikula commented 8 years ago

Do you have VirtualBox? I can prepare virtual machine for you.

Drachenkaetzchen commented 8 years ago

Yes I do, but I can't have a look at the issue for the next week, so I hope that APCu packages for Debian will be ready by then. Sorry for the delay!

Drachenkaetzchen commented 8 years ago

I just compiled the APCu cache, however, for some reason not clear to me the apc_fetch() method does not exist, only apcu_fetch(). I currently don't have time to investigate this further, if you like you could try to research if APCu is supposed to emulate methods like apc_fetch() or not.

Drachenkaetzchen commented 8 years ago

I just noticed that there's a bc module, so I could reproduce the problem.

I have opened an issue against the required parameter for apc_clear_cache: https://github.com/krakjoe/apcu-bc/issues/10

Drachenkaetzchen commented 8 years ago

It seems that the issue was fixed in apcu-bc, you could try with the new version and see if it works.

Drachenkaetzchen commented 8 years ago

I just tested with the latest apcu-bc and it works fine. Performance is impressive, a 50 rows part list only takes 83ms to retrieve on my machine.

MarekPikula commented 8 years ago

It works fine for me too. Can be closed :+1:

andriusr commented 7 years ago

I am having message that "PHP APCu cache not found", while in fact my config has it installed (verified with phpinfo()). Looking at this thread it seems that one needs backward compatible version of APCu, apcu-bc. So, the message is a bit confusing. Are there plans to do native APCu support?

Drachenkaetzchen commented 7 years ago

@andriusr can you open a separate issue for that?

KHuffman35 commented 6 years ago

On Linux Mint 18.1, installing PHP7.0-apcu-bc (backwards compatible cache) resolved the cache warning during install.