Happens after clicking UPDATE while editing media via non-grid media edit page.
I can’t believe that after you decided to release the plugin to all www.remarpro.com users, you think that all hostings are exactly like SiteGround. Making it available to users of other hosting you should have accounted that most of them prohibit exec() and you need to refactor the code to make it compliant with the best practice.
Message I receive in the Technical Issue email is following:
Error Details
An error of type E_ERROR was caused in line 176 of the file /home/xxx/public_html/wp-content/plugins/sg-cachepress/core/Images_Optimizer/Images_Optimizer_Webp.php. Error message: Uncaught Error: Call to undefined function SiteGround_Optimizer\Images_Optimizer\exec() in /home/xxx/public_html/wp-content/plugins/sg-cachepress/core/Images_Optimizer/Images_Optimizer_Webp.php:176
Stack trace: 0 /home/xxx/public_html/wp-content/plugins/sg-cachepress/core/Images_Optimizer/Images_Optimizer_Webp.php(95): SiteGround_Optimizer\Images_Optimizer\Images_Optimizer_Webp::generate_webp_file() 1 /home/xxx/public_html/wp-content/plugins/sg-cachepress/core/Images_Optimizer/Images_Optimizer_Webp.php(241): SiteGround_Optimizer\Images_Optimizer\Images_Optimizer_Webp->optimize() 2 /home/xxx/public_html/wp-includes/class-wp-hook.php(324): SiteGround_Optimizer\Images_Optimizer\Images_Optimizer_Webp->regenerate_webp_copy() 3 /home/xxx/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() 4 /home/xxx/public_html/wp-includes/plugin.php(517): WP_Hook->do_action() 5 /home/xxx/public_html/wp-includes/post.php(4791): do_action() 6 /home/xxx/public_html/wp-includes/post.php(6358): wp_insert_post() 7 /home/xxx/public_html/wp-includes/post.php(4976): wp_insert_attachment() 8 /home/xxx/public_html/wp-admin/includes/post.php(453): wp_update_post() 9 /home/xxx/public_html/wp-admin/post.php(227): edit_post() 10 {main}
thrown
exec()
?is not accessible. Ghostscript will not function.”
]]>I have a button in the WordPress admin panel that fires an AJAX-request to run a function hooked into wp_ajax_{$action}
. Then I was planning on running the WP-CLI-command with WP_CLI::runcommand()
inside the function called by AJAX. The problem is that WP_CLI is not available at this point. I then tried to use exec
and shell_exec
:
exec("wp command_name args");
This works as I want it to, but it blocks the script from continuing, and the browser waits for the AJAX-request to finish. Ok, so I thought I would find a way to run this WP-CLI-command in the background somehow. I have tried everything I could find, but I can’t get it to work.
This runs the command, but PHP hangs and is blocked until the command finishes:
exec("wp command_name args");
exec("wp command_name args > log.txt &");
exec("wp command_name args > NUL &");
exec("wp command_name args > \$null &");
shell_exec("wp command_name args");
shell_exec("wp command_name args > log.txt &");
shell_exec("wp command_name args > NUL &");
shell_exec("wp command_name args > \$null &");
These work for getting the non-blocking functionality I am after, but the command seem to not run at all (I at least get no error messages in the Apache log, and the file the command is supposed to create is never created):
exec("wp command_name args > /dev/null &");
exec("wp command_name args > /dev/null 2>&1 &");
exec("nohup wp command_name args > log.txt &");
exec("wp command_name args > /dev/null 2>/dev/null &");
exec("wp command_name args &> /dev/null &");
shell_exec("wp command_name args > /dev/null &");
shell_exec("wp command_name args > /dev/null 2>&1 &");
shell_exec("nohup wp command_name args > log.txt &");
shell_exec("wp command_name args > /dev/null 2>/dev/null &");
shell_exec("wp command_name args &> /dev/null &");
I can’t for the life of me figure out how to run a WP-CLI command from PHP, but let it run in the background and do its thing without halting PHP execution.
I am on XAMPP for Windows 10 right now for testing, if that matters.
]]>exec(“$swetest -edir$sweph -b{$this->ut_date} {$this->ut_time} -p{$this->planets} {$this->house} -eswe {$this->format} {$this->options} -g, -head”, $out);
$results = print_r ($out);
write_log($results);
—> $results ist “1”
—————
Even thought
swetest file okay
Ephemeris permissions okay
exec() okay
chmod() okay
PHP_SHLIB_SUFFIX so
————
could it be that my server does not run the executable file properly ?
I call them already and at first glance, there is nothing preventing the execution of swtest.
I would be very glad for your help,
best regards and thank you for your plugin.
I’m using php 7.3 and in php.ini, there no evidence about exec() but i get this error:
EWWW Image Optimizer requires exec() to perform local compression. Your system administrator has disabled the exec() function, ask them to enable it.
there is just these words in disable_functions:
disable_functions = show_source, system, shell_exec, passthru, popen, proc_open
what should i do ?
is there anything else to do ?
I found one of those functions (escapeshellarg) in /sucuri-scanner/src/command.lib/php.
Can you please explain why I should not be concerned and continue to use your plugin?
]]>### Begin System Info ###
-- Server Info
Server Software: Apache
PHP Version: 5.5.38
GD Support: Yes
PHP_SHLIB_SUFFIX: so
exec() Function: Enabled
chmod() Function: Enabled
-- ZodiacPress Info
swetest file: Okay
Ephemeris permissions: Executable
-- WordPress Info
WP Version: 4.9.4
Multisite: No
WP_DEBUG: Disabled
WP Memory Limit: 40M
-- Theme
Theme Name: Twenty Seventeen
Theme Version: 1.4
Is Child Theme: No
-- Active Plugins
ZodiacPress by Isabel Castillo, Cosmic Plugins version 1.7
### End System Info ###
Main site info
### Begin System Info ###
-- Server Info
Server Software: Apache
PHP Version: 5.5.38
GD Support: Yes
PHP_SHLIB_SUFFIX: so
exec() Function: Enabled
chmod() Function: Enabled
-- ZodiacPress Info
swetest file: Okay
Ephemeris permissions: Executable
-- WordPress Info
WP Version: 4.9.4
Multisite: No
WP_DEBUG: Disabled
WP Memory Limit: 40M
-- Theme
Theme Name: Enfold
Theme Version: 4.2
Is Child Theme: No
-- Active Plugins
Counter Number Showcase by wpshopmart version 1.0.5,
Current Planetary Positions by Isabel Castillo version 2.1.1,
Daily Moon Forecast by Isabel Castillo version 2.1.1,
HubSpot Tracking Code for WordPress by HubSpot version 1.2.1,
HubSpot - Free Marketing Plugin for WordPress by HubSpot version 6.1.4,
Moon Phases by Joe's Web Tools version 3.1.1,
Service Box by wpshopmart version 1.2.3,
Super Testimonial by Themepoints version 1.4,
Team Members by WP Darko version 3.0.1,
WooCommerce Variable Product Description by Shop Plugins version 1.0.1,
WooCommerce by Automattic version 3.3.4,
YITH WooCommerce Wishlist by YITHEMES version 2.2.1,
ZodiacPress by Isabel Castillo, Cosmic Plugins version 1.7,
ZodiacPress Windows Server by Isabel Castillo version 1.2.1
### End System Info ###
]]>and this plugin needs exec() function to be enabled and you know that 99% of web hosting disable this on shared hosting.
i wrote a support ticket but no answer!
]]>my hosting disabled exec() function for security reason I asked them to enable it but they told me they can not
and I really want to use this plugin is there any another way ? or how to fix this problem
I will appreciate it
Thanks
]]>EWWW Image Optimizer requires exec() or an API key. Your system administrator has disabled the exec() function, ask them to enable it.
Do I need to ask my hosting provider to enable exec()
?