Forum Moderators: coopster

Message Too Old, No Replies

Create a symlink between different users that targets to PHP

symlink, server, php, suexec, symbolic link, internal server error

         

dglite

12:51 pm on Jul 5, 2009 (gmt 0)

10+ Year Member



Hi, I’ve been working on a project for weeks and I can not solve this, hope you can give me an idea. I am working on a dedicated server, and I need to create some symlinks between different accounts and users...
Both accounts are on the same partition of the server (home) and I have root access and SSH access for everything.
If I create a symlink to a directory of another account and on that directory there is any HTML file (e.g. Index.html), that symlink works great and it shows the content on that file.
HOWEVER if the symlink targets to a directory in which there is a file in PHP (e.g. Index.php) or any script programmed in PHP (e.g. Joomla) it does not work and gives...
“Internal Server Error” + Additionally, a 404 Not Found error was encountered...

When I go to Cpanel the “error log” says...

[Sun Jul 05 09:15] [error] [client zz.zz.zz.zz] File does not exist: /home/zzz/public_html/500.shtml
[Sun Jul 05 09:15] [error] [client zz.zz.zz.zz] SoftException in Application.cpp:367: Mismatch between target UID (123) and UID (123) of file "/home/zzz/public_html/my-dir/my-symlink/index.php"

However, If go to SSH and edit server owner of the symlink, so both symlink and target file has the same owner (chown user:user directory_name) the problem is the same, but on the “error log” the UID Mismatch disappear and I only find...
File does not exist: /home/zzz/public_html/500.shtml

I’ve also tried modifying suexec by changing... “domain.com” for “domain-com” on the server alias, and does not work.

Here I give you more info about server file structure...

serveralias generation path...
/var/cpanel/userdata/USER/DOMAIN

suexec location...
/usr/local/apache/sbin/suexec

Server Information

System Linux
Apache Version 2.2.11 (Unix)
PERL Version 5.8.8
PHP Version 5.2.8

So the question is... HOW can I create a symlink between different users on the same dedicated server partition, that target to PHP scripts or how can I allow the server to execute PHP scripts through symlinks of different accounts?

Any help would be much appreciated, tks in advance!

bkeep

7:54 pm on Jul 5, 2009 (gmt 0)

10+ Year Member



I am only guessing here but since the HTML is just being read and the PHP has to be parsed on the server I bet there is some security feature in place to prevent you from executing php files.

Just curious, what is the need you have to symlink from usera to a file that resides in userb's directory?

bkeep

9:08 pm on Jul 5, 2009 (gmt 0)

10+ Year Member



I waited to long to add this since I actually had to look.
Check the PHP open_basedir Tweak located in the security center of your Root WHM Panel Only turn this off if you are sure as the security implications seem pretty high if you have other users who you can't control.

PHP's open_basedir protection prevents users from opening files outside of their home directory with PHP.

I would look there I also found a topic somewhat related for drupal [drupal.org...]

good luck

dglite

11:42 am on Jul 6, 2009 (gmt 0)

10+ Year Member



Hi: first of all thanks for your fast reply and for your interest in helping us, that´s excellent.

- In reply to your first question, we need that an user shows the content of other user, because we are making a multimple sites project, so a domain host the sites and another domain gives the domain name. Is the best way to do this using symbolic links? Or there is any way on WHM to give to the same user, 2 domains to administrate with the same absolute path or partition of the server?

- In reply to your second question, I went to WHM >> Server Configuration >> Tweak Settings, but there is no openbase_dir option, is there any place where I can find it and modify it? Or is there any way to change it using a PHP.INI file inside pubic_html of any account, so I dont have to edit server configuration for other accounts?

I want to thank you again for your time, is great to find webmasters helping others, see u...

bkeep

7:34 pm on Jul 6, 2009 (gmt 0)

10+ Year Member



WHM >> Server Configuration >> Tweak Settings is the wrong location for the open_basedir setting it is located at

Main >> Security >> Security Center

dglite

10:55 pm on Jul 6, 2009 (gmt 0)

10+ Year Member



Hi: I would like to thank you all for your help, it was just great. I was able to solve it. In the end I did not have to use symlinks, but your instructions helped me a lot to understand the situation and were very usefull, I really appreciate that!

:)