trix21 Posted June 24, 2010 Share Posted June 24, 2010 Okay pretty simple problem to explain... but can't figure it out. running a php script through shell.. easy: php myscript.php myscript.php has standard GD lib functions such as imagecreate() etc... Runs fine in browser, when trying to run it through shell... Warning: call to undefined function imagecreate() in etc... So why can't a script being run through shell not recognize gd but running it through the browser can? Thanks for the help Quote Link to comment https://forums.phpfreaks.com/topic/205748-calling-php-script-through-shell-wont-use-gd/ Share on other sites More sharing options...
premiso Posted June 24, 2010 Share Posted June 24, 2010 It is using a different php.ini file for the CLI. Find out where your browser is point to (ie which .ini file using phpinfo then use this to call the script: php -c /path/to/for/browsers/phpini/ myscript.php The -c does: -c <path>|<file> Look for php.ini file in this directory Quote Link to comment https://forums.phpfreaks.com/topic/205748-calling-php-script-through-shell-wont-use-gd/#findComment-1076665 Share on other sites More sharing options...
trix21 Posted June 24, 2010 Author Share Posted June 24, 2010 okay got that going and i see that it's reading from that ini file now... but here is the next problem (This is running through shell... like i said browser is fine) PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20060613/gd.so' - (null) in Unknown on line 0 and checked... file does exist. Quote Link to comment https://forums.phpfreaks.com/topic/205748-calling-php-script-through-shell-wont-use-gd/#findComment-1076670 Share on other sites More sharing options...
premiso Posted June 24, 2010 Share Posted June 24, 2010 Never encountered. http://www.somacon.com/p447.php Plus other google searches for that may help you figure it out. Quote Link to comment https://forums.phpfreaks.com/topic/205748-calling-php-script-through-shell-wont-use-gd/#findComment-1076672 Share on other sites More sharing options...
trix21 Posted June 24, 2010 Author Share Posted June 24, 2010 Hmm... maybe this is the problem? phpinfo says Configuration File (php.ini) Path /usr/local/php5/lib Loaded Configuration File /usr/local/php5/lib/php.in extension is trying to be pulled from /usr/local/php/ (not php5) is it worth a try to cp the gd.so file to other location? Quote Link to comment https://forums.phpfreaks.com/topic/205748-calling-php-script-through-shell-wont-use-gd/#findComment-1076675 Share on other sites More sharing options...
premiso Posted June 24, 2010 Share Posted June 24, 2010 You can do that, or just create a Symbloic link to the php5 folder. Since that is not working, you can just copy the php.ini that the browser uses to the cli location and use that instead. Which should point to the correct extension DIR etc. Not sure if this is a good "idea" to do, but should work none the less. Quote Link to comment https://forums.phpfreaks.com/topic/205748-calling-php-script-through-shell-wont-use-gd/#findComment-1076677 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.