Jump to content

Calling PHP script through shell (won't use GD)


trix21

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:

  Quote
-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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.