Any idea why Execute PHP would not be working on our server? It works great on my local machine MAMP setup and I'm excited to try it out on our server.
Hmm. Your server's PHP might be set to "safe mode", if it's running PHP 5.3 or lower.
Or, you might have the "eval()" function disabled in your PHP settings. Some servers come with eval() disabled by default, because of how powerful it is.
Look for the "disable_functions" directive in your php.ini file, and see if eval is listed.
If those don't work, what type of server are you running on? Windows, Linux/Unix, etc?
I just looked into it a little more actually, and I don't think your php.ini "disable_functions" directive would be the cause.
Everything I've read says that can't disable eval(). Just to confirm that you can't use eval() anywhere else, try writing a very simple php script in your webserver, like this:
<?php
eval("print 'hello I worked';");
?>
Save it as test.php, then visit it in a web browser. If it prints anything, it means eval DOES work on your server. If not, it at least proves that's the problem.
I have seen that servers with "Suhosin" installed can create a blacklist of functions, and that is where eval might be disabled, if your server is set up that way. This would be an Apache configuration, not PHP. Richard
eval() is working. Safe_mode is disabled. There is nothing listed in disable_functions for PHP. Linux server.
When I try to use the Execute PHP and hit 'Save settings', I am returned to the same page. On MAMP, I go to a new page (flightpath/system-handle-form-submit) and see my "hello world" printed on the page.
I just threw an exit(); in the PHP I was trying to run and this time it stopped me on the "hello world" page.
echo "hello world";
exit();
Not sure why it automatically stopped on my local machine, but not the web server. So, it is working after all.
Well, actually it's supposed to take you back to the Execute PHP page, once it is done executing. I think on your local machine it was crashing, actually, it just happened to be what you needed ;)
Try this:
In the Execute PHP box, enter:
fpm("hello world");
No exit statement. Just hit save. You should see the result when the page reloads, as a flightpath message at the top of the screen.
Hmm. Your server's PHP might be set to "safe mode", if it's running PHP 5.3 or lower.
Or, you might have the "eval()" function disabled in your PHP settings. Some servers come with eval() disabled by default, because of how powerful it is.
Look for the "disable_functions" directive in your php.ini file, and see if eval is listed.
If those don't work, what type of server are you running on? Windows, Linux/Unix, etc?
Thanks
Richard
I just looked into it a little more actually, and I don't think your php.ini "disable_functions" directive would be the cause.
Everything I've read says that can't disable eval(). Just to confirm that you can't use eval() anywhere else, try writing a very simple php script in your webserver, like this:
<?php
eval("print 'hello I worked';");
?>
Save it as test.php, then visit it in a web browser. If it prints anything, it means eval DOES work on your server. If not, it at least proves that's the problem.
I have seen that servers with "Suhosin" installed can create a blacklist of functions, and that is where eval might be disabled, if your server is set up that way. This would be an Apache configuration, not PHP. Richard
eval() is working. Safe_mode is disabled. There is nothing listed in disable_functions for PHP. Linux server.
When I try to use the Execute PHP and hit 'Save settings', I am returned to the same page. On MAMP, I go to a new page (flightpath/system-handle-form-submit) and see my "hello world" printed on the page.
I just threw an exit(); in the PHP I was trying to run and this time it stopped me on the "hello world" page.
echo "hello world";
exit();
Not sure why it automatically stopped on my local machine, but not the web server. So, it is working after all.
Well, actually it's supposed to take you back to the Execute PHP page, once it is done executing. I think on your local machine it was crashing, actually, it just happened to be what you needed ;)
Try this:
In the Execute PHP box, enter:
fpm("hello world");
No exit statement. Just hit save. You should see the result when the page reloads, as a flightpath message at the top of the screen.
Richard
fpm("hello world"); is working on both, taking me back to the Execute PHP page. Thanks!