smurraysb Posted May 14, 2008 Share Posted May 14, 2008 Hi, I'm currently running php5 and mysql v5 and am trying to install an application via php5 cli, but I'm getting errors such as PHP Notice: Undefined index: SERVER_PORT in /srv/www/htdocs/Sugar/install.php on line 178 PHP Notice: Undefined index: SERVER_NAME in /srv/www/htdocs/Sugar/install.php on line 181 PHP Notice: Undefined index: SERVER_PORT in /srv/www/htdocs/Sugar/install.php on line 181 These errors of usage of the $_SERVER are only in the file it's self, but it branches out to many files in the tree, which also used $_SERVER calls. I feel this may adversely be effecting my MySQL queries. I'm relatively new to php5 command line usage, so I guess the big question, is if there is a way to pass the $_SERVER array to the php5 cli? Thanks for the help! Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted May 14, 2008 Share Posted May 14, 2008 Command line PHP does not set the $_SERVER array, since there is no web server invoking it. Ken Quote Link to comment Share on other sites More sharing options...
smurraysb Posted May 14, 2008 Author Share Posted May 14, 2008 Thanks for the response! Hmmm, thats what I thought. Do you know if there is some way to dump the $_SERVER array into a file so that I can include it into the file? Quote Link to comment Share on other sites More sharing options...
trq Posted May 14, 2008 Share Posted May 14, 2008 Put simply, if this scriot your trying to install is intended for use through the web, its not likely going to be of much use to you on the command line. Why exactly are you running this script via the command line? Quote Link to comment Share on other sites More sharing options...
smurraysb Posted May 14, 2008 Author Share Posted May 14, 2008 I need to run it through command line so that I can install the app remotely. I'm fairly sure that the install should work via cli, because it's worked in older versions (this is a fairly new version I'm working on right now), and also the install runs fine, it's just after, when going to the index page for app usage, I'm getting MySQL errors. This is the only thing that I can pin them too, after looking through a lot of the source PHP and seeing that $_SERVER calls are used quite often, I feel that command line silent install was overlooked a bit in this version. But if I pass in the $_SERVER array, it should work as it's original intent is. Only problem there is I'm not sure how to print this array. Thanks again for the help Quote Link to comment Share on other sites More sharing options...
trq Posted May 14, 2008 Share Posted May 14, 2008 'm fairly sure that the install should work via cli, because it's worked in older versions (this is a fairly new version I'm working on right now), and also the install runs fine, it's just after, when going to the index page for app usage, I'm getting MySQL errors. And what errors are they exactly? You can pass the $_SERVER array to a cli script but its kinda pointless. You'll need to make a wrapper script, call that via a server, then include your cli script. eg; wrapper.php <?php include 'your_cli_script.php'; ?> Call this via a server and it should bring the $_SERVER array into scope for the your_cli_script.php script, of course, its just as easy to request the script directly from a server itself. Quote Link to comment Share on other sites More sharing options...
smurraysb Posted May 14, 2008 Author Share Posted May 14, 2008 I see, so either which way, I $_SERVER requires browser usage. Well, it was worth asking, haha. As for the MySQL errors I'm getting Query Failed: AND users.id = '1'::MySQL error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND users.id = '1'' at line 1 Which I'm thinking that somewhere along building the query out, there is an if statement that is based on a $_SERVER variable, causing a the query to fail. You might recognize a problem more than I do though, any ideas? EDIT: Well, I'm off until Friday, I'll respond then, thanks again for the help! Quote Link to comment Share on other sites More sharing options...
trq Posted May 15, 2008 Share Posted May 15, 2008 We need to see some code relevent to that query. Quote Link to comment Share on other sites More sharing options...
smurraysb Posted May 16, 2008 Author Share Posted May 16, 2008 That's the funny part about it though I did a grep -inHR "users\.id" * and got nothing involving a MySQL query... I can't seem to find this particular query anywhere... baffling... Well, for the most part, I think this is pretty much resolved Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.