To do this, I copied the repository WP CLI into Root WordPress
And I wrote the following PHP code to encode it and encountered the following errors
define('WP_CLI_ROOT', ABSPATH . 'wp-cli');
require_once WP_CLI_ROOT . '/php/wp-cli.php';
Warning: include_once(D:\Web\Sites\jupiterx/wp-cli/vendor/rmccue/requests/library/Requests.php): failed to open stream: No such file or directory in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Bootstrap\IncludeFrameworkAutoloader.php on line 48
Warning: include_once(): Failed opening 'D:\Web\Sites\jupiterx/wp-cli/vendor/rmccue/requests/library/Requests.php' for inclusion (include_path='C:\xampp\php\PEAR') in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Bootstrap\IncludeFrameworkAutoloader.php on line 48
Warning: include_once(D:\Web\Sites\jupiterx/wp-cli/vendor/wp-cli/mustangostang-spyc/Spyc.php): failed to open stream: No such file or directory in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Bootstrap\IncludeFrameworkAutoloader.php on line 49
Warning: include_once(): Failed opening 'D:\Web\Sites\jupiterx/wp-cli/vendor/wp-cli/mustangostang-spyc/Spyc.php' for inclusion (include_path='C:\xampp\php\PEAR') in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Bootstrap\IncludeFrameworkAutoloader.php on line 49
Warning: array_slice() expects parameter 1 to be array, null given in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Runner.php on line 905
Warning: Invalid argument supplied for foreach() in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Configurator.php on line 138
Warning: implode(): Invalid arguments passed in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Runner.php on line 1024
Fatal error: Uncaught Error: Class 'cli\Colors' not found in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Loggers\Regular.php:70 Stack trace: #0 D:\Web\Sites\jupiterx\wp-cli\php\class-wp-cli.php(881): WP_CLI\Loggers\Regular->error_multi_line(Array) #1 D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Runner.php(248): WP_CLI::error_multi_line(Array) #2 D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Runner.php(1083): WP_CLI\Runner::set_wp_root('D:\\Web\\Sites\\ju...') #3 D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Bootstrap\LaunchRunner.php(23): WP_CLI\Runner->start() #4 D:\Web\Sites\jupiterx\wp-cli\php\bootstrap.php(74): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState)) #5 D:\Web\Sites\jupiterx\wp-cli\php\wp-cli.php(27): WP_CLI\bootstrap() #6 D:\Web\Sites\jupiterx\wp-content\plugins\tabanShahrSiteSaz\Plugin.php(72): require_once('D:\\Web\\Sites\\ju...') #7 D:\Web\Sites\jupiterx\wp-content\plugins\tabanShahrSiteSaz\app\core\SingletonPattern.php(26): TabanShahrSiteSaz\Plugin->includes() #8 D:\Web\Sites\jupiterx\wp-conten in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Loggers\Regular.php on line 70
Thanks in advance for your help
WP-CLI can only be run correctly under the PHP cli SAPI, not under a web server API like cgi, apache or similar. This has some technical reasons, but it is also directly related to your server's security.
WP-CLI is a console application
The first technical reason is that WP-CLI is a console application, and it assumes access to the console input (STDIN) and output (STDOUT) streams. Within the web server context that WordPress runs under, these don't exist. The "input" for a webserver is the URL and payload of a web request, and the output is the HTML or JSON that is sent back to the browser.
WP-CLI is a wrapper around WordPress
The second technical reason is that WP-CLI is basically a "hack" that "wraps" an entire WordPress installation and executes it as a subroutine within its own process. If you would try to use WordPress to launch WP-CLI, you'd have a chicken & egg problem, or a software interpretation of "Inception".
WP-CLI is a sysadmin tool
The reason why this is also directly relevant in terms of security is that WP-CLI is, in the broadest sense, a sysadmin tool. It will directly create, modify, delete files, do direct requests against the database, and more. All of its operations can bypass any security measures that might have been put in place at the application level by WordPress and its plugins. Making WP-CLI accessible to the public-facing frontend and letting it be triggered via web requests would turn it into a critical security vulnerability. No server-side administration tool should be exposed to the frontend in whatever way.
Hopefully, this explains why what you want to do cannot be done and why you would not want to if you could.
Related
I loaded the latest version of the Fast and Easy Checkout Plugin for ZenCart. (2.1.8) I'm using ZenCart version 1.5.5 MySQL 5.5.45 and PHP 5.4.45 .
It is not working and I'm finding this in my log:
[23-Jun-2016 20:18:55 UTC] Request URI: /zen-cart-v155/thiRd-EMP-Brick/configuration.php?gID=32, IP address: 208.102.139.70
#1 trigger_error() called at [/home/dblisasmith/public_html/zen-cart-v155/includes/functions/plugin_support.php:68]
#2 plugin_version_check_for_updates() called at [/home/dblisasmith/public_html/zen-cart-v155/thiRd-EMP-Brick/includes/init_includes/init_css_js_loader_config.php:79]
#3 require(/home/dblisasmith/public_html/zen-cart-v155/thiRd-EMP-Brick/includes/init_includes/init_css_js_loader_config.php) called at [/home/dblisasmith/public_html/zen-cart-v155/includes/autoload_func.php:48]
#4 require(/home/dblisasmith/public_html/zen-cart-v155/includes/autoload_func.php) called at [/home/dblisasmith/public_html/zen-cart-v155/thiRd-EMP-Brick/includes/application_top.php:171]
#5 require_once(/home/dblisasmith/public_html/zen-cart-v155/thiRd-EMP-Brick/includes/application_top.php) called at [/home/dblisasmith/public_html/zen-cart-v155/thiRd-EMP-Brick/configuration.php:12]
[23-Jun-2016 20:18:55 UTC] PHP Notice: CURL error checking plugin versions: 28:Connection timed out after 9000 milliseconds
Trying file_get_contents() instead. in /home/dblisasmith/public_html/zen-cart-v155/includes/functions/plugin_support.php on line 68
I've been working on this for two days to get this far, and I'm stumped.
there is a folder called extras and within there is a curltester.php script.
i would ensure that curl is working first from that script. you might have to edit the .htaccess file in that directory to get that script to load.
the error does not seem related to FEC.
The error in question:
[RuntimeException]
Error Output: PHP Warning: require(/home/admin/web/"webpage"/public_html/test/app/Http/helpers.php): failed to open stream: N
o such file or directory in /home/admin/web/"webpage"/public_html/test/vendor/composer/autoload_real.php on line 58
PHP Stack trace:
PHP 1. {main}() /home/admin/web/"webpage"/public_html/test/artisan:0
PHP 2. require() /home/admin/web/"webpage"/public_html/test/artisan:16
PHP 3. require() /home/admin/web/"webpage"/public_html/test/bootstrap/autoload.php:17
PHP 4. ComposerAutoloaderInit95cd02d44d232a8b8d6e5e52544d8647::getLoader() /home/admin/web/"webpage"/public_html/test/vendor
/autoload.php:7
PHP 5. composerRequire95cd02d44d232a8b8d6e5e52544d8647() /home/admin/web/"webpage"/public_html/test/vendor/composer/autoload
_real.php:49
PHP Fatal error: require(): Failed opening required '/home/admin/web/"webpage"/public_html/test/app/Http/helpers.php' (includ
e_path='/home/admin/web/"webpage"/public_html/test/vendor/phpunit/php-text-template:/home/admin/web/"webpage"/pub
lic_html/test/vendor/phpunit/php-timer:.:/usr/share/pear:/usr/share/php') in /home/admin/web/"webpage"/public_html/test/vendor
/composer/autoload_real.php on line 58
PHP Stack trace:
PHP 1. {main}() /home/admin/web/"webpage"/public_html/test/artisan:0
PHP 2. require() /home/admin/web/"webpage"/public_html/test/artisan:16
PHP 3. require() /home/admin/web/"webpage"/public_html/test/bootstrap/autoload.php:17
PHP 4. ComposerAutoloaderInit95cd02d44d232a8b8d6e5e52544d8647::getLoader() /home/admin/web/"webpage"/public_html/test/vendor
/autoload.php:7
PHP 5. composerRequire95cd02d44d232a8b8d6e5e52544d8647() /home/admin/web/"webpage"/public_html/test/vendor/composer/autoload
_real.php:49
Background: Was developing locally, got to the point where I wanted to have a staging site. Set up the staging site on digital ocean (entOS 6.5 x64). I then cloned my git repo into my desired folder - configured vhosts DefaultDirectory to my public path.
A default installation works, composer update/install works. However, with my cloned repository I am getting said error. '/home/admin/web/"webpage"/public_html/test/app/Http/helpers.php' is a file I made with some helper methods I could use in various controllers. It has not caused any problems locally. I can composer update/install locally, without any problems.
Any guidance would be greatly appreciated!
Are those literal quotation marks in your file path
/home/admin/web/"webpage"/public_html/test/app/Http/helpers.php
Or are you just using that to indicate your website name normally goes there? If the former, I'd consider not doing that as it's pretty weird to have quotes in unix file names, and you may run into problems based on assumptions other people have made.
Regardless -- you have the information you need
[RuntimeException] Error Output: PHP Warning: require(/home/admin/web/"webpage"/public_html/test/app/Http/helpers.php): failed to open stream: N o such file or directory in /home/admin/web/"webpage"/public_html/test/vendor/composer/autoload_real.php
PHP is telling you it tried to require in a specific file
/home/admin/web/"webpage"/public_html/test/app/Http/helpers.php
but it could not find it ("failed to open stream"). This means either the file doesn't exist on the computer you're trying to load it from, or PHP can't see it for some reason (try dumping the results of is_readable('/home/admin/web/"webpage"/public_html/test/app/Http/helpers.php'); to see if PHP thinks it can read the file or not.
I'm trying out the tutorials for Facebook developers. However, I can't include the Facebook PHP SDK successfully in my code. As stated, require_once("facebook_sdk/facebook.php"); throws the following error:
Warning: require_once(facebook_sdk/facebook.php) [function.require-once]: failed to
open stream: Permission denied in /opt/lampp/htdocs/awesome/plas.php on line 2
Fatal error: require_once() [function.require]: Failed opening required 'facebook_sdk/facebook.php'
(include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/awesome/plas.php on line 2
I am developing under Lucid Lynx. I tried doing chmod 777 facebook.php but the problem persists. I found this SO question but the resolution arrived at (renaming the file, as it may be conflicting with one of PHP's own) does not work for me. (Come to think of it, how will a file named facebook.php conflict with internal PHP files?!) Even if I switch to plain require, the same warnings are thrown.
Curiously, if I copy the files (facebook.php and base_facebook.php) outside of facebook_sdk and change the require_once line accordingly, the require succeeds. Any thoughts?
Your web server needs read access right to facebook_sdk/facebook.php. You can do it by chowning the directory to the web server user. chmod 777 is not a good practice.
Also make sure for each of include path, facebook_sdk/facebook.php exists.
I'm using Doctrine 1.2.
The code is trying to include some entities (in the example, AdvertiserUsers) by adding the suffix "Table" at the end. I print a trace at the end of this message.
The thing is, my app does not use these files! I have my models called AdvertiserUsers on the style, with no need for an AdvertiserUsersTable file. Actually, I have my models called "AdvertiserUsers" only, and my app works OK without it (ugly warnings aside - which I want to get rid of).
I don't know why it tries to include these files that are not needed. This is the actual issue.
As a side note, my application has been doing this after I integrated an external module (from a freelance) that used a direct connection - no Doctrine - and happens on this module, when having to integrate both and using separate connections for different data.
Trace:
[26-Jul-2011 22:59:06] PHP Warning: include_once(AdvertiserUsersTable.php): failed to open stream: No such file or directory in /usr/local/zend/share/ZendFramework/library/Zend/Loader.php on line 146
[26-Jul-2011 22:59:06] PHP Warning: include_once(): Failed opening 'AdvertiserUsersTable.php' for inclusion (include_path='/usr/local/zend/apache2/htdocs/stats-from-zero/application/../library:/usr/local/zend/apache2/htdocs/stats-from-zero/library:/usr/local/zend/apache2/htdocs/stats-from-zero/library/doctrine::/usr/local/zend/apache2/htdocs/stats-from-zero/library/recaptcha-php-1.10:/usr/local/zend/apache2/htdocs/stats-from-zero/public/php-form-builder-class:.:/usr/local/zend/share/ZendFramework/library:/usr/local/zend/share/pear:/usr/local/zend/apache2/htdocs/stats-from-zero/application/modules/stats/models:/usr/local/zend/apache2/htdocs/stats-from-zero/application/modules/stats/forms') in /usr/local/zend/share/ZendFramework/library/Zend/Loader.php on line 146
AdvertiserUsersTable.php does not exist. Check name of that file & specific directory. It should be there
For the longest time now I've been trying to convert HTML pages containing large tables to PHP. These are styled with CSS and can be several pages long.
I first tried DOMPDF. It works great, until a document is more than one page. None of the fixes I've found work. Either it errors out, or any element that would be even partially on the second page gets lumped over the content of page 1. I've tried both the latest release and the SVN copy I checked out today.
I also tried html2ps/pdf, and it gives me "permission denied" errors writing to the cache directory, even though the directory is fully writable. The system requirements test script passes. The server is running PHP 5 under IIS (not my choice heh).
Can either of these be convinced to work, or is there a library that can do it?
Errors from the demo/test scripts:
Warning: file_put_contents(C:\Inetpub\wwwroot\JM\pdf\html2ps\cache/7d888258e9745b3716532ea81342daaf.css.compiled) [function.file-put-contents]: failed to open stream: Permission denied in C:\Inetpub\wwwroot\JM\pdf\html2ps\css.cache.class.php on line 33
Warning: fopen(C:\Inetpub\wwwroot\JM\pdf\html2ps\cache/unicode.lb.classes.dat) [function.fopen]: failed to open stream: Permission denied in C:\Inetpub\wwwroot\JM\pdf\html2ps\inline.content.builder.php on line 991
Warning: flock() expects parameter 1 to be resource, boolean given in C:\Inetpub\wwwroot\JM\pdf\html2ps\inline.content.builder.php on line 992
Warning: fwrite(): supplied argument is not a valid stream resource in C:\Inetpub\wwwroot\JM\pdf\html2ps\inline.content.builder.php on line 1011 (this error repeats several thousand times)
Warning: fopen(C:\Inetpub\wwwroot\JM\pdf\html2ps\cache/times.z) [function.fopen]: failed to open stream: Permission denied in C:\Inetpub\wwwroot\JM\pdf\html2ps\pdf.fpdf.makefont.php on line 318
Can't write to file C:\Inetpub\wwwroot\JM\pdf\html2ps\cache/times.z
A similar problem with html2pdf under IIS has been discussed here.
The solution was quite simple, yet weird. If this doesn't help you, a full error-message and / or a little bit of code would help me to help you.
I personally recommend command line applications instead of any PHP libraries.
Reasons :
PHP libraries need more time and memory (cache) for conversion process.
They need well-formatted HTML pages only, otherwise throw errors or warnings.
No support for external style sheets.
Command Line Tool:
If you run your script on a Linux server then I suggest command line tools.
Reasons :
They are extremely fast compared to PHP libraries.
Support CSS.
Accept non-well-formatted HTML.
Which command line tool to use?
wkhtmltopdf
htmltopdf
html2pdf
For more information refer to Converting HTML to PDF (not PDF to HTML) using PHP.