Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access (under which URL) ? #45

Closed
panique opened this issue Feb 15, 2020 · 2 comments
Closed

How to access (under which URL) ? #45

panique opened this issue Feb 15, 2020 · 2 comments

Comments

@panique
Copy link

panique commented Feb 15, 2020

Hi there,

thanks for putting work into this project, I highly adore this.
However, I could not find any information in the README that shows how to access the GUI when installing via Composer, even when working through the docs multiple times and even reading most of the code.

Can you please add this extremely essential info ? :)

@fyrye
Copy link

fyrye commented Feb 17, 2020

Since you're using composer, there are way too many usage examples to document. For example if you're using a Framework like Symfony/Laravel, you could load opcache-gui in a Controller.
So where access exists and how it is initialized, is ultimately up to you to decide and configure.
You will also need to configure your own security options based on your environment to protect file access.
Although general usage of OpcacheGui\OpCacheService::init(); should be documented somewhere in the README or USAGE file.


For the below examples change /var/www/html with your DOCUMENT_ROOT path and /var/www/vendor with your composer vendor path.
e.g. to allow viewing at https://example.com/opcache.php

First, as with any composer package, create a file to load OpcacheGui\OpCacheService.
Again this is up to you to configure for your environment.

touch /var/www/html/opcache.php

Then edit the file to load the composer autoload.php file and instantiate the OpcacheGui\OpCacheService object.

<?php
/** /var/www/html/opcache.php */
require_once __DIR__ . `/../vendor/autoload.php`;

/** specify your options */
$options = array(/* ... */);

\OpcacheGui\OpCacheService::init($options);

Alternatively include amnuts/opcache-gui/index.php directly to use the default $options

<?php
/** /var/www/html/opcache.php */
require_once __DIR__ . `/../vendor/amnuts/opcache-gui/index.php`;

Or as the README states, copy amnuts/opcache-gui/index.php into your document path and make changes to the file as desired..

cp /var/www/vendor/amnuts/opcache-gui/index.php /var/www/html/opcache.php

@amnuts
Copy link
Owner

amnuts commented Feb 19, 2020

That was a great response @fyrye, thank you!

I'll attempt to update the README soon. I'm a little behind with making updates to the opcahce-gui since the newer version of PHP have come out, so need to carve out time for it properly. 😄

@amnuts amnuts closed this as completed Feb 19, 2020
@amnuts amnuts reopened this Feb 19, 2020
@amnuts amnuts closed this as completed in e649443 Feb 22, 2020
humengcn pushed a commit to humengcn/opcache-gui that referenced this issue Dec 31, 2020
Moved around the content a bit so the more important stuff comes first, and added some extra details thanks to @fyrye.  This should resolve amnuts#45.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants