Re: PHP and MSSQL on Linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



System commands are supposed to output errors on STERR, not on STOUT, php's 
system commands only grab STOUT so if there's an error you'll get no output.. 
You need to redirect STERR to STOUT when you issue the command.. 

Just put this at the end of your command: 
2>&1

Don't know if that's the issue, but it sounds like it. 

-Micah 


On Wednesday 02 November 2005 11:36 am, php@xxxxxxxxxxxx wrote:
> I ran it as the apache user and it worked fine (from the command line).
>   I do notice that when I run a system command using the exec or system
> functions, I get nothing back on some of the commands (primarily
> traceroute and ping).  Others do work (whoami)
>
> Robbert
>
> Micah Stevens <micah@xxxxxxxxxxxxxxxxxx> wrote on 11/02/2005, 07:58:55
>
> PM:
> > Run it from the command line as the apache user. See if that makes a
> > difference. I'd guess not though.
> >
> > Apache's php module doesn't really put any restrictions that I know of on
> > the scripting.. that's a strange effect..
> >
> > On Wednesday 02 November 2005 10:54 am, php@xxxxxxxxxxxx wrote:
> > > I originally posted this to the general discussion but wanted to see if
> > > anyone on this list had an idea.  The issue is trying to connect to the
> > > MSSQL with PHP from a linux box (Fedora Core 4 in this instance)
> > >
> > > > An interesting development.  I found some reference to running my PHP
> > > > script from the command line to take Apache out of the picture.  Lo
> > > > and behold, the script worked.  I was able to connect to the server. 
> > > > So the issue seems to be related with Apache.  Any idea what I would
> > > > need to do there to make the script work via the web?
> > > >
> > > > Robbert
> > > >
> > > > php@xxxxxxxxxxxx wrote on 11/02/2005, 05:50:01 PM:
> > > > > Thanks for your help.  I'd love to hear if you have any success
> > > > > with the RPMs.  Something I've seen over and over again in the
> > > > > documentation is the compilation of php adding "--with-mssql".  My
> > > > > PHP info output does not include that marker.
> > > > >
> > > > > The output is as follows
> > > > > './configure' '--build=i386-redhat-linux'
> > > > > '--host=i386-redhat-linux' '--target=i386-redhat-linux-gnu'
> > > > > '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr'
> > > > > '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
> > > > > '--datadir=/usr/share' '--includedir=/usr/include'
> > > > > '--libdir=/usr/lib' '--libexecdir=/usr/libexec'
> > > > > '--localstatedir=/var' '--sharedstatedir=/usr/com'
> > > > > '--mandir=/usr/share/man'
> > > > > '--infodir=/usr/share/info' '--cache-file=../config.cache'
> > > > > '--with-libdir=lib' '--with-config-file-path=/etc'
> > > > > '--with-config-file-scan-dir=/etc/php.d' '--disable-debug'
> > > > > '--with-pic' '--disable-rpath' '--with-bz2' '--with-curl'
> > > > > '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr'
> > > > > '--with-png-dir=/usr'
> > > > > '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext'
> > > > > '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl'
> > > > > '--with-png' '--with-pspell' '--with-expat-dir=/usr'
> > > > > '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU'
> > > > > '--enable-exif' '--enable-ftp' '--enable-magic-quotes'
> > > > > '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm'
> > > > > '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid'
> > > > > '--enable-yp' '--enable-wddx'
> > > > > '--with-pear=/usr/share/pear' '--with-kerberos'
> > > > > '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr'
> > > > > '--enable-memory-limit' '--enable-shmop' '--enable-calendar'
> > > > > '--enable-dbx' '--enable-dio'
> > > > > '--with-mime-magic=/etc/httpd/conf/magic' '--without-sqlite'
> > > > > '--with-libxml-dir=/usr' '--with-xml'
> > > > > '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd'
> > > > > '--without-odbc' '--disable-dom' '--disable-dba'
> > > > >
> > > > > Howver, under additional .ini files parsed, I see the mssql file:
> > > > > /etc/php.d/ldap.ini, /etc/php.d/mssql.ini, /etc/php.d/mysql.ini,
> > > > > /etc/php.d/mysqli.ini, /etc/php.d/odbc.ini
> > > > >
> > > > > And further on down are the mssql configuration settings.
> > > > >
> > > > > Rick Emery  wrote on 11/02/2005, 05:19:06 PM:
> > > > > > Quoting php@xxxxxxxxxxxx:
> > > > > > > Yup, I thought that was the problem too but when I added my
> > > > > > > server to the conf file, there was no change.  When you set up
> > > > > > > your MSSQL connection in fedora, did you install anything else
> > > > > > > other than MSSQL and PHP-MSSQL?  Or did you have to set
> > > > > > > anything in your php.ini file to use the new extension?
> > > > > >
> > > > > > Well, I didn't have the rpms; I compiled from source. I don't
> > > > > > have that box available anymore, but I've checked my notes.
> > > > > > First, I compiled freetds (nothing special in the configure
> > > > > > line), then I compiled php using "--with-mssql=/usr" (to point to
> > > > > > the freetds libraries). All of this should have been handled
> > > > > > within the rpms, though, and if phpinfo is showing the mssql
> > > > > > extension loaded, I'm not sure why it wouldn't be working. I
> > > > > > don't remember modifying php.ini at all for the mssql stuff.
> > > > > >
> > > > > > Hopefully over the next couple of days I'll have some time to set
> > > > > > up a test box and try the rpms to which you pointed me, to see if
> > > > > > I run into the same trouble.
> > > > > >
> > > > > > Rick
> > > > > >
> > > > > > --
> > > > > > PHP General Mailing List (http://www.php.net/)
> > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > > > --
> > > > > PHP General Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux