Page 1 of 1

PHP Code not working in OpenBSD 3.7

Posted: Tue Jul 13, 2010 7:16 am
by robertsonpatty
Hi guys, I'm having some issues with PHP in my OpenBSD 3.7 box. PHP seems to be working well so i really don't know what's on with this.

here are my installed extensions and packages:

php5-bz2-5.2.12p0 bzip2 compression extensions for php5
php5-core-5.2.12p1 server-side HTML-embedded scripting language
php5-curl-5.2.12p0 curl URL library extensions for php5
php5-extensions-5.2.12p1 informational package about PHP5 extensions
php5-fastcgi-5.2.12 stand-alone FastCGI version of PHP
php5-imap-5.2.12p0 imap, pop3 and nntp extensions for php5
php5-mysql-5.2.12p0 mysql database access extensions for php5
php5-mysqli-5.2.12p0 mysql database access extensions for php5
php5-sqlite-5.2.12p0 sqlite database access extensions for php5

the below is the full code i am having problems with, this code perfectly runs in my other box but not on this obsd box :

Code: Select all

<?
$user = "sampleuser";
$password = "samplepass";
$u_id = "sampleid";
$baseurl ="http://api.baseurl.com";
// auth call
$url = "$baseurl/getvalues?user=$user&password=$password&u_id=$u_id";
// do auth call
ret = file($url);
echo "Values are: ". $ret[0];
exit();
?>
i was thinking if this is a problem||restriction with suhosin? from the logs i get:

Code: Select all

222.52.74.17 - - [13/Jul/2010:19:07:25 +0800] "GET /0x0.php?=[b]SUHO8567F54-D428-14d2-A769-00DA302A5F18[/b] HTTP/1.1" 200 2825
222.52.74.17 - - [13/Jul/2010:19:07:25 +0800] "GET /0x0.php?=PHPE9568F35-D428-11d2-A769-00AA001ACF42 HTTP/1.1" 200 2158
222.52.74.17 - - [13/Jul/2010:19:07:26 +0800] "GET /0x0.php HTTP/1.1" 200 55341
222.52.74.17 - - [13/Jul/2010:19:14:12 +0800] "GET /start/x.php HTTP/1.1" 200 342
attached is my phpinfo:

http://x.arpa.im/0x0.php

thanks in advance!

Re: PHP Code not working in OpenBSD 3.7

Posted: Tue Jul 13, 2010 7:42 am
by Weirdan
To start with, you code has syntax error: ret = file($url), should be $ret = file($url);
Also you should know that ability to use resources identified by urls as if they were files is controlled by allow_url_fopen php.ini setting.

Re: PHP Code not working in OpenBSD 3.7

Posted: Tue Jul 13, 2010 8:05 am
by robertsonpatty
Thanks Weirdan. The missing $ in ret was a typo. I tried setting the allow_url_fopen in php.ini to On. However, I am getting the same results of a blank page. If this won't work then I'm planning to re-write everything, perhaps usng curl as an alternative?

Re: PHP Code not working in OpenBSD 3.7

Posted: Tue Jul 13, 2010 8:35 am
by Weirdan
robertsonpatty wrote:However, I am getting the same results of a blank page.
Check your error logs