Scripting in SKINS : PHP, Perl etc.

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
9,051
Hello,

The only way to set that up (a bit weary about doing it) is to add the username to the /etc/proftpd.passwd file.

1) find the UID and GID #'s for "diradmin"
Code:
id diradmin
2) run this:
Code:
echo "directadminskins:cryptedpass:UID:GID:comments:/usr/local/directadmin/data/skins:/bin/false" >> /etc/proftpd.passwd
replace UID and GID with the numbers found in step 1.
replace crytpedpass with a password of your chosing:
PHP:
[server]#  php
<?
echo crypt("password","randomcharacters")."\n";
?>
press ctrl-D twice to finish. The generated text will be the crypted password.

Then just login as directadminskins to the server IP with "password" and you should be sitting in the skins directory.

John
 

warpsmith

Verified User
Joined
Nov 14, 2003
Messages
8
Thank you for the detailed reply.

Based on the caveats, I will continue to work on trying to get embedded PHP to work in an admin template, rather than a server template. So far, having no luck with either type of template, but still trying...
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
9,051
Hello,

What exactly are you trying to do with the scripts? The skin scripts won't have the required privilege to upload a skin to be server wide because the scripts are run as the logged in user, not diradmin.

John
 

warpsmith

Verified User
Joined
Nov 14, 2003
Messages
8
Thanks for the follow-up.

I am trying to get PHP to work embedded within a skin.

Earlier posts in this thread seemed to imply that the process has a better chance of working as a server template. So I tried that and got the familiar 'file not found' that others are getting, even as a server template. Then I realized that developing and maintaining a server template is a bit more difficult (for good reason, given the extra security built in).

So now I am trying to get the embedded PHP to work within an admin-owned template. Even tried putting PHP under the admin directory, but still hitting problems. Will keep trying - having PHP with a DA skin opens up a lot of uses for DA for us.
 

CyberAlien

Verified User
Joined
Oct 28, 2003
Messages
229
Location
Mars
Weird. PHP doesn't work when skin is uploaded server-wide, but works fine if skin is uploaded to admin account in skins directory. Any solutions?
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
9,051
Hello,

There isn't any difference for the DA program other than the document root path.. it's probably something else like a permissions issue.. Try breaking it down to a very simple php command "echo 'hi';" or something and work up from there.

John
 

CyberAlien

Verified User
Joined
Oct 28, 2003
Messages
229
Location
Mars
Even more weird: same skin uploaded to same directory using same account (admin). First time was uploaded using wget using account admin and unpacked on server. Second time it was unpacked on computer and uploaded using ftp. Only when uploaded with ftp php can be used. When uploaded with wget it shows same error as on loopforever's screenshot.
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
9,051
Hello,

Right now the scripting won't work in the filemanager because it's chrooted. Other things like the password protected directories are also chrooted to /home/username, so when you're accessing php, it would be looking in:

/home/username/usr/local/bin/php

Not too sure how to get around that.

John
 

CyberAlien

Verified User
Joined
Oct 28, 2003
Messages
229
Location
Mars
Yes, but php doesn't work even in other scripts, not only filemanager. It doesn't work even on index page, unless i'm uploading with ftp to my home directory.
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
9,051
Hello,

I'm working on the filemanger issue right now. It should be working on all other pages (excluding filemanger and protected directories). If your upload method changes the functionality using the same script then either the permissions are weird or possibly the file format is non-standard (ie. windows sometimes adds ^M characters at the end of the lines).

John
 

CyberAlien

Verified User
Joined
Oct 28, 2003
Messages
229
Location
Mars
interesting idea. i'll convert all files to unix format before compressing it and will try it. thanks.

edit: it was indeed \r\n instead of \n at the end of files that was causing problem. thanks a lot!!!
 
Last edited:
Top