Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

running php from command line

Status
Not open for further replies.

livestrong

Technical User
Nov 27, 2006
29
IE
Hi Everyone,

I'm trying to get php working from the command line / terminal. (os - fedora core 4)
Just trying to run a simple test script to echo a variable.

Code:
#!/usr/bin/php
<?php
$test = 'mytest';
echo $test;
?>

when i try run the script

->php test.php

Im getting the following error

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/ldap.so' - /usr/lib/php/modules/ldap.so: undefined symbol: empty_string in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysql.so' - /usr/lib/php/modules/mysql.so: undefined symbol: empty_string in Unknown on line 0
PHP Warning: PHP Startup: D¡/: Unable to initialize module
Module compiled with module API=20041030, debug=0, thread-safety=0
PHP compiled with module API=20050922, debug=0, thread-safety=0
These options need to match
in Unknown on line 0

Any ideas??
 
you have not compiled mysql on the same machine as you have compiled php.

if you are not familiar with compiling programs from source code, have a hunt for a LAMP package.

however i'd guess that fedora uses some kind of package manager that you'd be able to download and autoinstall the right packages. i'd kill the current installations of apache, mysql and php and then reinstall them in this order

mysql
apache
[libraries, i.e. libcurl, jpeg, png, gd, sqlite, libxml etc etc]
php5


 
Hi Jpadie,

Do you think this is the case even though php / mysql works fine through apache?

Killing the current installations would really be the last option.

I remember when installing the packages there was no mysql supprot for my php, and i had to make a few changes this may be causing the inconsistencies.
 
then you're addressing a different instance of php through the command line.
try
Code:
sudo locate php

i suspect you should find two different installations.

the other way of doing it is run a phpinfo from the web server and compare it to the output of the command line

Code:
php -r "phpinfo();"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top