LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-08-2010, 05:54 AM   #1
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298
Blog Entries: 61

Rep: Reputation: Disabled
Problems with sheevaplug-installer runme.php script


Could anyone who knows PHP have a look at the attached runme.php (remove the .txt) in my latest LQ blog entry, and point out what's wrong? TIA.

Last edited by brianL; 09-08-2010 at 06:08 AM.
 
Old 09-08-2010, 07:13 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hi

I took a look at the script. My guess is that it's PHP because the same script can then be used on both Windows as well as Linux.

Line 7:
PHP Code:
/* find out if we run on Linux/Windows*/
if (strstr($_ENV["OS"], "Windows"))
    
$WIN32=1
This simply means set the variable WIN32 to 1 if the environment variable "OS" contains the word "Windows". What error message does it make? If it doesn't matter if it works on Windows or not, you can simply delete those lines.

Line 43:
PHP Code:
    if ($_ENV["USER"] != 'root')
        die(
"You must run this as root\n"); 
This line checkes if the environment variable "USER" is "root" and if not, exit with the error message. The problem here I think is that you run the script with sudo. Then "USER" does not change to root. A better way to check this:

PHP Code:
if (posix_geteuid() != 0)
        die(
"You must run this as root\n"); 
 
1 members found this post helpful.
Old 09-08-2010, 07:29 AM   #3
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298

Original Poster
Blog Entries: 61

Rep: Reputation: Disabled
Thanks for the reply. The installer package has a runme.exe for use on Windows, so I don't know why they they included that option in the script. Yeah, you're probably right about sudo, since all the installing, etc, from Linux information is oriented towards Ubuntu. I'll try your suggestions next time I have a go at it.
 
Old 09-08-2010, 10:08 AM   #4
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298

Original Poster
Blog Entries: 61

Rep: Reputation: Disabled
I've written about my progress (or lack of it) in comments on my blog.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing PHP script in crontab (include path problems) bar338 Linux - Newbie 5 12-21-2009 02:36 PM
Problems running PHP script in command line Hondro Linux - Software 1 06-21-2007 04:16 AM
LXer: Title: PHP/MySQL Classifieds Script AddAsset1.php Script Insertion LXer Syndicated Linux News 0 07-02-2006 06:21 PM
apache problems with a Php script kudos Linux - Software 2 09-23-2003 04:54 PM
problems running php script rhuser Linux - Software 5 02-14-2003 01:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration