lunanat
asked on
Enable MSSQL.SO - Ubuntu 9.02 - apache2 - php5
So, I'm not a unix beginner, but I'm by no means a well versed user.
I'm trying to set up a LAMP server, minus the MySQL. We have MS SQL servers, which I'd like the apache/php to work with.
To that effect, I've got a problem. I can't seem to get php to load the mssql.so. Using mssql_connect() generates an error saying that the function is undefined.
Phpinfo() is in the code snippet.
My installation steps are as follows, from a clean install of ubuntu 9 (i386)
Prep:
1) apt-get build-dep apache2
2) apt-get build-dep php5
3) apt-get build-dep freetds
A) apache2
1) apt-get install apache2
B) freetds
1) apt-get source freetds
2) ./configure --prefix=/usr/local/freetd s --wth-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld
3) make && make install
C) php5
1) apt-get source php5
2) ./configure --with-mssql=/usr/local/fr eetds
3) make && make install
4) apt-get install libapache2-mod-php5
5) /etc/init.d/apache2 reset
D) mssql.so
1) cd /ext/mssql
2) phpize
3) ./configure --with-mssql=/usr/local/fr eetds
4) make && make install
5) /etc/init.d/apache2 reset
E) php.ini
1) nano /etc/php5/apache2/php.ini
a) add extension=mssql.so to the extensions section
2) /etc/init.d/apache2 reset
F) mssql.ini
1) nano /etc/php5/conf.d/mssql.ini
a) extension=mssql.so <-- redundant to step E, but I figured it wouldn't hurt to try?
2) /etc/init.d/apache2 reset
I'm trying to set up a LAMP server, minus the MySQL. We have MS SQL servers, which I'd like the apache/php to work with.
To that effect, I've got a problem. I can't seem to get php to load the mssql.so. Using mssql_connect() generates an error saying that the function is undefined.
Phpinfo() is in the code snippet.
My installation steps are as follows, from a clean install of ubuntu 9 (i386)
Prep:
1) apt-get build-dep apache2
2) apt-get build-dep php5
3) apt-get build-dep freetds
A) apache2
1) apt-get install apache2
B) freetds
1) apt-get source freetds
2) ./configure --prefix=/usr/local/freetd
3) make && make install
C) php5
1) apt-get source php5
2) ./configure --with-mssql=/usr/local/fr
3) make && make install
4) apt-get install libapache2-mod-php5
5) /etc/init.d/apache2 reset
D) mssql.so
1) cd /ext/mssql
2) phpize
3) ./configure --with-mssql=/usr/local/fr
4) make && make install
5) /etc/init.d/apache2 reset
E) php.ini
1) nano /etc/php5/apache2/php.ini
a) add extension=mssql.so to the extensions section
2) /etc/init.d/apache2 reset
F) mssql.ini
1) nano /etc/php5/conf.d/mssql.ini
a) extension=mssql.so <-- redundant to step E, but I figured it wouldn't hurt to try?
2) /etc/init.d/apache2 reset
PHPInfo() (there is no mssql section below the summary)
System Linux lamp 2.6.31-14-generic-pae #48-Ubuntu SMP Fri Oct 16 15:22:42 UTC 2009 i686
Build Date Jan 6 2010 22:15:47
Server API Apache 2.0 Handler
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/php5/apache2
Loaded Configuration File /etc/php5/apache2/php.ini
Scan this dir for additional .ini files /etc/php5/apache2/conf.d
additional .ini files parsed /etc/php5/apache2/conf.d/mssql.ini, /etc/php5/apache2/conf.d/pdo.ini
PHP API 20041225
PHP Extension 20060613
Zend Extension 220060519
Debug Build no
Thread Safety disabled
Zend Memory Manager enabled
IPv6 Support enabled
Registered PHP Streams https, ftps, compress.zlib, compress.bzip2, php, file, data, http, ftp, zip
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed
Did you typo the path? Your step (F) shows /etc/php5/conf.d/mssql.ini while your phpinfo() snippet shows /etc/php5/apache2/conf.d/m ssql.ini.
ASKER
Hmm.. no I did not typo - doing a locate mssql.ini shows the file in /etc/php5/conf.d, however when I try to cp the file to /etc/php5/apache2/conf.d it says that the file is already present - and when I list that directory (and cat the file) things are indeed the way the phpinfo says it is.
Deleting the mssql.ini file out of apache2/conf.d also removed the file from php5/conf.d. I recreated the file in apache2/conf.d (echo extension=mssql.so > mssql.ini), and restarted apache2. No changes to the phpinfo, and no mssql support.
Deleting the mssql.ini file out of apache2/conf.d also removed the file from php5/conf.d. I recreated the file in apache2/conf.d (echo extension=mssql.so > mssql.ini), and restarted apache2. No changes to the phpinfo, and no mssql support.
Restart your Apache service, then look in the main error log for any errors. On my Ubuntu installation, the default log is /var/log/error.log. I see this during the spin-up:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613/ms sql.so' - /usr/lib/php5/20060613/mss ql.so: cannot open shared object file: No such file or directory in Unknown on line 0
If you see a similar warning, try this command:
sudo find / -iname mssql.so
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613/ms
If you see a similar warning, try this command:
sudo find / -iname mssql.so
ASKER
Hmm.. I get a different error. I'll start googling that error, but I'll post it here as well in case you have some ideas:
PHP Warning: PHP Startup: Invalid Library (maybe not a php library) 'mssql.so' in Unknown on line 0
PHP Warning: PHP Startup: Invalid Library (maybe not a php library) 'mssql.so' in Unknown on line 0
ASKER
So, I think I'm running in the right direction now.. but wow did this just make a mess of things.
Since I'm running VMware, I'll just roll the snapshot back to a clean install and try everything again, but here's what I think the problem was (after some googling):
In PHP, I need to run the following configure:
./configure --with-mssql=/usr/local/fr eetds --with-apxs2=/usr/bin/apxs 2
After doing this, it obliterated a lot of the phpinfo.. which is why I want to start fresh.. but after I've tried again, I'll let you know what happens.
Since I'm running VMware, I'll just roll the snapshot back to a clean install and try everything again, but here's what I think the problem was (after some googling):
In PHP, I need to run the following configure:
./configure --with-mssql=/usr/local/fr
After doing this, it obliterated a lot of the phpinfo.. which is why I want to start fresh.. but after I've tried again, I'll let you know what happens.
ASKER
Dead end on the apxs2 configure option.. if it is a step in the right direction, it involves about 10 steps in the wrong direction first.
Using that config option kills about 85% of the pre-configured options... no php.ini file, for example.
I will keep googling other options, hope to hear from you soon.
Using that config option kills about 85% of the pre-configured options... no php.ini file, for example.
I will keep googling other options, hope to hear from you soon.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you, after manually specifying all of the config settings (you weren't kidding when you said it'd be a long command), using the with-apxs2 command, everything works perfectly.
LAMP is now working with MSSQL.
LAMP is now working with MSSQL.
That's not an answer!
What is the command you ended up using?
That's the solution.
What is the command you ended up using?
That's the solution.