Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
talaena
Aug 30, 2003

Danger Mouse! Power House!
I was hoping someone could enlighten me on a PHP/SSL problem I am experiencing. I have narrowed this down to one very simple PHP command that works through firefox, but fails via the php cli. Esentially, I can't load any url that starts with https:

/ # cat t.php
<?
echo "HTTPS:\n".file_get_contents('https://www.google.co.uk/ig?hl=en');
?>
/ #

Simple command to go get a web page. If I load it through firefox, I get the google webpage. If I go to a command line and run 'php t.php' I get:

Warning: file_get_contents(): SSL: No such file or directory in t.php on line 2
Warning: file_get_contents(): Failed to enable crypto in t.php on line 2
Warning: file_get_contents(https://www.google.co.uk/ig?hl=en): failed to open stream: Invalid argument in t.php on line 2

If I change it to http: it loads just fine on the command-line and via firefox. I'm assuming I've either compiled PHP incorrectly and/or I am missing something glaringly obvious. My searches through google haven't been successful, but I think that's mainly due to my inexperience with PHP; I've only been working with this for a couple weeks. I don't really know what to search google for beyond the error code s themselves.

I am Running HP/UX 11.11 with php 5.2.5 and apache 2.0.58.

/ # uname -a
HP-UX bob B.11.11 U 9000/800 2002324811 unlimited-user license

/# php -v
PHP 5.2.5 (cli) (built: Feb 27 2008 13:58:33)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

Adbot
ADBOT LOVES YOU

talaena
Aug 30, 2003

Danger Mouse! Power House!

bitprophet posted:

Yea, you probably managed to compile the CLI version of PHP without SSL support, but mod_php (which is often a separate package in package managers) with. I don't remember if phpinfo() gives meaningful output when run via CLI, but if it does, that should make it explicit - it would list the build args and all the modules it's got set up.


I run php -m from the command line and I get:
/ # p -m
[PHP Modules]
ctype
...
openssl
...
[Zend Modules]
/ #

That leads me to believe I have openssl compiled properly, I think. Since the apache/php combo works, perhaps Apache loads some kind of environment variable that I do not have set at the shell. "SSL: No such file or directory" is so incredibly non-descriptive, I have no clue what to look for. I wish I could print more detailed error message about what it is expecting.

talaena
Aug 30, 2003

Danger Mouse! Power House!
I assume this would be the place for a UNIX sort question? Maybe the linux thread? - except I'm running on HP/UX and the sort is different. Anyway:

I'm trying to get UNIX to sort a field numerically, then alpha and I can't come up with a graceful way to do it:

code:
4 TREES      505BEOATR ONS   R1=41256R2=447957
4 TREES      505BEOATR ONS   R1=41256R2=447958
4 TREES      505BEOATR ONS   R1=41256R2=447990
4 TREES      505BEOATR 1.5   R1=44272R2=758734
4 TREES      505BEOATR 1.5   R1=44272R2=775346
4 TREES      505BEOATR 1.75  R1=44273R2=630577
4 TREES      505BEOATR 1.75  R1=44273R2=684902
4 TREES      505BEOATR 2.0   R1=42099R2=737818
4 TREES      505BEOATR 2.0   R1=42099R2=738778
4 TREES      505BEOATR 3F3   R1=41244R2=479405
4 TREES      505BEOATR 3F3   R1=41244R2=821169
4 TREES      505BEOATR 10F3  R1=44060R2=981805
4 TREES      505BEOATR 10F3  R1=44060R2=991913
4 TREES      505BEOATR 12F2  R1=41568R2=479362
4 TREES      505BEOATR 12F2  R1=41568R2=514930
The code is formatted thusly. and the sort command:

code:
sort -k1.1,1.22 -k1.23n,1.29
gets the 4th column sorted numerically how I want it; but the ONS' are at the top. I want them at the bottom with the numeric sorting above intact. If I remove the n, the sort naturally reverts to alpha and the ONS drops down; but the 10's and 12's move up where they shouldn't be.

I feel like I'm missing something stupid (I usually am); and my natural instinct is to develop a inanely complex solution. I want to ignore that urge and actually find a proper solution.

The file isn't just that above, but it's a series of grouped data points that are all perfectly sorted, except the ONS's need to move down to the bottom of each subset. I feel like awk might do it, but every time I man awk I feel like kicking myself in the junk

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply