user1927468
user1927468

Reputation: 1133

Display PHP Opcode without execution

To display the opcode for a specific file (example.php), there are two extensions VLD and Zend Opchache.

VLD has the property to generate the opcode without executing the file, when we choose vld.execute=0.

php -d vld.active=1 -d vld.execure=0 example.php

My question: Can I generate the opcode by using Zend Opcache but without executing the file? And what I have to change in the configuration file to have this option?

php -d opcache.opt_debug_level=0x10000 example.php

Upvotes: 0

Views: 445

Answers (2)

Yihang Wang
Yihang Wang

Reputation: 11

phpdbg ^1 also works as you needed.

phpdbg -p='*' /app/index.php

Upvotes: 0

Matthew Turland
Matthew Turland

Reputation: 763

Yes, by invoking opcache_compile_file() and passing it the file path.

You can do this from CLI like so:

php -d opcache.opt_debug_level=0x10000 -r 'opcache_compile_file("example.php");'

Upvotes: 2

Related Questions