Page 1 of 1

PHP CLI problem

Posted: Tue Jun 05, 2007 4:28 pm
by umattu
I have a ubuntu Dapper LAMP server up and running a ticketing system at my company. The system is oneorzero, I have the system running perfectly on the http side of things. The site works, the tickets can be created from the web interface, it emails notifications via postfix to the ticket managers and what not.

The problem comes in when tickets are emailed to the system. I have set up a job in crontab to check for emails for the system. When it sees a message it will grab the message but it will not interact with mysql. I get the following error.

Fatal error: Call to undefined function mysqli_connect() in /var/www/common/mysql5.class.php on line 51

I had this problem initially with the web end but I uncommented this extension in the php.ini file in the apache2 directory which smoothed everything over.

I tried adding these extensions, mysql.so and mysqli.so to the php.ini file found in the cli directory but it is not working, I made sure the path to the extensions were corret in the /cli/php.ini file, but when i runthe job I get this error:

PHP Warning: PHP Startup: Unable to load dynamic library './usr/lib/php5/ext/mysqli.so' - ./usr/lib/php5/ext/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library './usr/lib/php5/ext/mysql.so' - ./usr/lib/php5/ext/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
Could not open input file: phpinfo

What am I missing here? I have been trying to work through this problem for 4 days now and I am hardly gaining ground. I am happy that I discovered that the terminal (cli) is working off of a different php.ini file then apache is but it seems not to be working.

I installed the Lamp server from a dapper server install disc and I am positive that both extension, mysql.so and mysqli.so exist and that the paths to them in the /etc/php5/cli/php.ini file is correct.


Please HELP!!!!!!

Posted: Tue Jun 05, 2007 4:30 pm
by RobertGonzalez
What is your extensions directory set to in php.ini? Do these files exists:

Code: Select all

./usr/lib/php5/ext/mysqli.so
./usr/lib/php5/ext/mysql.so

Posted: Tue Jun 05, 2007 4:41 pm
by umattu
Yes both of those files exist

Both /etc/php5/apache2/php.ini as well as /etc/php5/cli/php.ini have this /usr/lib/php5/ext/ as the path to the extensions.

Apache has no problem with those extensions at all it is just cli that does.

Posted: Tue Jun 05, 2007 4:52 pm
by umattu
Thanks for the quick reply, I feel like a heel wasting the forums time now. When you asked what php.ini was pointing to for the extensions directory, i verified by looking at the files. the paths were totally correct, EXCEPT that in the cli php.ini I had the path in there as ./usr/lib/php5/ext/ I looked at that file a thousand times and did NOT see the period prefixing the path. I removed the period and all is well in PHP land.

Again I apologize for my ignorance!

Posted: Tue Jun 05, 2007 5:05 pm
by RobertGonzalez
Believe it or not, that was going to be my next question. But I am glad you got it fixed.

Posted: Tue Jun 05, 2007 7:55 pm
by umattu
Heck even now that I look at the error message I can see the periods in the path. I just can't beleive it took me so long to realize something that simple.

Thanks again.