Jump to content

Recommended Posts

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

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

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.

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?

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.