Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: sareea on August 12, 2011, 12:01:35 PM



Title: PHP white screen
Post by: sareea on August 12, 2011, 12:01:35 PM
Hello all ,
recently i tried to install a frontend php script on my server .
At first the index file didn't seem to run, and if i try to download it it downloads blank .
The script requires Memcached , i had only memcached installed , and after i installed php5-memcache some of the script seemed to run, but it is not loading any other php file .

All i get a white screen.
Please help ! It is urgent !

Thanks a lot !


Title: Re: PHP white screen
Post by: newminerr on August 12, 2011, 12:36:24 PM
Do you have ioncube installed?


Title: Re: PHP white screen
Post by: sareea on August 12, 2011, 12:41:09 PM
Nope ,
these are my settings
http://78.47.162.164/testphp.php


Title: Re: PHP white screen
Post by: newminerr on August 12, 2011, 12:52:06 PM
Ok, which file is returning blank.

And can you provide a snippet of the begining of the file?


Title: Re: PHP white screen
Post by: sareea on August 12, 2011, 01:00:01 PM
This is the script that is found there
https://github.com/simplecoin/simplecoin

http://78.47.162.164/


Title: Re: PHP white screen
Post by: Raoul Duke on August 12, 2011, 01:05:54 PM
turn error reporting on and it should tell you what the problem is ;)

put this in the php file your trying to run
Code:
error_reporting(-1);


Title: Re: PHP white screen
Post by: sareea on August 12, 2011, 01:25:24 PM
I get these errors
Code:
[Fri Aug 12 16:11:18 2011] [error] [client 109.66.112.62
] PHP Warning:  fopen(/var/www/api/pool/speed): failed t
o open stream: No such file or directory in /var/www/inc
ludes/stats.php on line 62

[Fri Aug 12 16:11:19 2011] [error] [client 109.66.112.62
] PHP Warning:  fopen(/var/www/api/pool/speed): failed t
o open stream: No such file or directory in /var/www/inc
ludes/stats.php on line 62, referer: http://78.47.162.16
4/register.php

[Fri Aug 12 16:11:21 2011] [error] [client 109.66.112.62
] PHP Warning:  fopen(/var/www/api/pool/speed): failed t
o open stream: No such file or directory in /var/www/inc
ludes/stats.php on line 62, referer: http://78.47.162.16
4/stats.php

PHP Warning:  fopen(/var/www/api/pool/speed): failed t
o open stream: No such file or directory in /var/www/inc
ludes/stats.php on line 62, referer: http://78.47.162.16
4/gettingstarted.php

[error] [client 58.218.199.22
7] script '/var/www/proxyheader.php' not found or unable
 to stat

[Fri Aug 12 16:10:52 2011] [error] [client 109.66.112.62
] PHP Warning:  fopen(/var/www/api/pool/speed): failed t
o open stream: No such file or directory in /var/www/inc
ludes/stats.php on line 62, referer: http://78.47.162.16
4/register.php

[Fri Aug 12 16:11:13 2011] [error] [client 109.66.112.62
] PHP Warning:  fopen(/var/www/api/pool/speed): failed t
o open stream: No such file or directory in /var/www/inc
ludes/stats.php on line 62, referer: http://78.47.162.16
4/register.php

[Fri Aug 12 16:11:16 2011] [error] [client 109.66.112.62
] PHP Warning:  fopen(/var/www/api/pool/speed): failed t
o open stream: No such file or directory in /var/www/inc
ludes/stats.php on line 62, referer: http://78.47.162.16
4/register.

] PHP Warning:  fopen(/var/www/api/pool/speed): failed t
o open stream: No such file or directory in /var/www/inc
ludes/stats.php on line 62, referer: http://78.47.162.16
4/about.php

[Fri Aug 12 16:10:49 2011] [error] [client 109.66.112.62
] PHP Warning:  fopen(/var/www/api/pool/speed): failed t
o open stream: No such file or directory in /var/www/inc
ludes/stats.php on line 62, referer: http://78.47.162.16
4/about.php

[Fri Aug 12 16:10:51 2011] [error] [client 109.66.112.62
] PHP Warning:  fopen(/var/www/api/pool/speed): failed t
o open stream: No such file or directory in /var/www/inc
ludes/stats.php on line 62, referer: http://78.47.162.16
4/stats.php

After i check in apache2 error.log file ...  But i don't think this would stuck all the script :S ?


Title: Re: PHP white screen
Post by: Raoul Duke on August 12, 2011, 01:33:26 PM
So, you must check what file is being called on line 62 of /inc
ludes/stats.php and that's your problem.


Title: Re: PHP white screen
Post by: sareea on August 12, 2011, 04:53:42 PM
The problem now is that it doesn't have the permissions to access it ...
And i installed ioncube loader ...
And Can you please take a look  at my php configurations and tell me if one of the security modules is causing this ?
Thanks !


Title: Re: PHP white screen
Post by: Raoul Duke on August 12, 2011, 05:50:41 PM
The problem now is that it doesn't have the permissions to access it ...
And i installed ioncube loader ...
And Can you please take a look  at my php configurations and tell me if one of the security modules is causing this ?
Thanks !
Why do you need ioncube loader? Is a open source script encrypted with ioncube? Or was it because something else on the server needed it?

To fix the permissions, just CHMOD the file with the right permissions using your FTP client.

If it needs 777 permissions on the file to run, please ditch the script LOL or install suPHP, i dunno ;)

Or did you by any chance uploaded the files with your server root account instead of a normal user account? If so, you'll need to chown the files to the correct user.

Not familiar with simplecoin, just with webservers in general. I haven't seen anything in their (small) documentation that said you need to have register_globals, open_base_dir or safe_mode on or off


Title: Re: PHP white screen
Post by: sareea on August 13, 2011, 07:59:35 AM
Thanks a lot for your help,
i created the speed file and gave it 777 permissions , and wow ... The script seemed to run ...
Yeah i uploaded them as a root , would this be a problem ? What should i do ?

Now i get another problem with the fopen()
Code:
] PHP Warning:  Invalid argument supplied for foreach()
in /var/www/stats.php on line 75

[Sat Aug 13 11:47:01 2011] [error] [client 84.228.254.88
] PHP Fatal error:  Call to a member function fetch() on
 a non-object in /var/www/includes/stats.php on line 42,
Do you think it is the script problem ?

Thanks a lot !!


Title: Re: PHP white screen
Post by: Raoul Duke on August 13, 2011, 08:27:07 AM
Thanks a lot for your help,
i created the speed file and gave it 777 permissions , and wow ... The script seemed to run ...
Yeah i uploaded them as a root , would this be a problem ? What should i do ?

Now i get another problem with the fopen()
Code:
] PHP Warning:  Invalid argument supplied for foreach()
in /var/www/stats.php on line 75

[Sat Aug 13 11:47:01 2011] [error] [client 84.228.254.88
] PHP Fatal error:  Call to a member function fetch() on
 a non-object in /var/www/includes/stats.php on line 42,
Do you think it is the script problem ?

Thanks a lot !!

Dude, big mistake uploading them as root. chown them to some user with less privileges and you won't need to use 777 on the files. That's a lot insecure for servers facing the web.

Can't tell you exactly to which user to chown them without knowing your server.


Probably this query is not returning a value, so it gives an error.
Code:
$sql = "SELECT count(id) FROM shares WHERE id > $lastwinningshare AND our_result='N'";
Most likely it will go away as soon as it returns something.


Title: Re: PHP white screen
Post by: sareea on August 13, 2011, 08:35:00 AM
Can you please give me the CHOWN command ? for user called x with password y ?
Thanks a lot !
I will look into that php later and update this .Thanks a lot mate !


Title: Re: PHP white screen
Post by: Raoul Duke on August 13, 2011, 10:09:31 AM
Can you please give me the CHOWN command ? for user called x with password y ?
Thanks a lot !
I will look into that php later and update this .Thanks a lot mate !

To change the owner of ALL dirs and files under a given dir
Code:
chown -R user:group /dir/to/change/owner

But dude, seriously, a google search would give you an answer faster than me  ::)

http://lmgtfy.com/?q=chown+command


Title: Re: PHP white screen
Post by: sareea on August 13, 2011, 02:35:04 PM
How can i fix it ?
$sql = "SELECT count(id) FROM shares WHERE id > $lastwinningshare AND our_result='N'";

?

Is it possible due to mysql failure ?


Title: Re: PHP white screen
Post by: Xephan on August 13, 2011, 03:16:06 PM
How can i fix it ?
$sql = "SELECT count(id) FROM shares WHERE id > $lastwinningshare AND our_result='N'";

?

Is it possible due to mysql failure ?

Try asking the author, it would be faster since he would be much more familiar with the code than us trying to troubleshoot/debug based on snippets that you might had made changes to.

http://simplecoin.lefora.com/


Title: Re: PHP white screen
Post by: Furyan on August 13, 2011, 03:34:26 PM
Make sure you've set up your database; make sure you've configured Simplecoin with a mysql user and password, with a user that has permissions to create tables, and insert, update, select and delete data.

As Xephan notes, the Simplecoin author can help you faster than we can..