PHP5 compiled/installed how to add to other domain


#1

Hi, finally i get my own php5 working in my primary domain.
But, how can i add to my other domain and subdomains?

Wiki says:

“If you would like to use this single installation with your other domains, you can place a symbolic link (ln -s source target) to /cgi-bin in your other domain roots.”

I didn’t understand, can you help me, people?
Thanks.


#2

You could have a look for ‘man ln’ in Google which shows you how to link to other files in other folders.

But I should think that your PHP will be available to anyone in your group. This usually means your main account and any users/domains added since they all get assigned the same group unless you manually assign a new group.

So perhaps you just need an ini_set instruction in your PHP files.

I have my own installed PEAR version and I share it out by adding.

ini_set(
‘include_path’,
ini_get( ‘include_path’ ) . PATH_SEPARATOR . “/home/.//pear/php”
);

into the required PHP script.

That would be a pain to do for a lot of scripts so I would presume an entry in each domains .htaccess file may be possible. Hopefully someone will be along shortly to assist.

Using the pathnames,like what I do, is not really the best way btw since the server names can change so you may want to use $_SERVER[‘DOCUMENT_ROOT’] instead.

Try a forum search I am sure this has cropped up before once or thrice.


Norm

Opinions are my own views and are not the views of DreamHost.
Any advice offered by me should be acted upon only at your own risk.


#3

What the Wiki means is this:

First off, the domain has to be on the same server. If it’s under the same user account, things are simpler. In windows terms, a softlink is the same thing as an alias.

You compiled PHP5 and have PHP5 CGI in /home/user/php/bin/php.cgi

What you should do is create a centralized “cgi-bin” directory in your main directory: /home/user/php-cgi/
Copy php.cgi into /home/user/php-cgi/

Then you create a softlink (ln) to that directory across your domains:
ln -s /home/user/php-cgi /home/user/domain1.com/php-cgi
ln -s /home/user/php-cgi /home/user/domain2.com/php-cgi

Now, in your .htaccess file, point your Action handler to /php-cgi/php.cgi instead of /cgi-bin/php.cgi

Hope you followed that. Why is the directory named “php-cgi?” That is just a name. I did that so you can keep a sepereate /cgi-bin/ for all your domians. Softlinks and directories don’t stack. Feel free to change the name to something else if you want.

I also did not link to /home/user/php/bin intentionally for security purposes. If you softlink to that directory, anybody can access every executable file from the browser within that directory.


yerba# rm -rf /etc
yerba#


#4

Thank you :slight_smile:

I’m new in SSH commands, i follow what you said, first i forgot to change .htacess, but now is working great.


#5

@guice

Something strange happening.
I did all the things u wrote, it’s working in all domains except one.

I get error in fopen “Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in /home…”

All other domains have fopen working (i need this to use a script) except this one. Change already .htacess, put softlink…etc.

Php.ini is valid to all domains? Or i can have this to each domain?

Any idea to solve this?

Thanks in advance.


#6

Check to make sure it’s using your PHP. Create a file (I name it info.php) with a single line: <? phpinfo()? ?> and then view it in your browser. That’ll tell you what PHP it’s using. Make sure it’s yours. If it is, see if allow_url_fopen is On or not.

My guess is it’s not using your PHP install for some unknown reason. Make sure it is.


yerba# rm -rf /etc
yerba#


#7

Not the same php, one is PHP Version 5.1.4 (yes, allow_url_fopen On) and domain is not workin fopen is 5.1.2.

I did all again, delete softlink, create again, .htacess, what more can i do?


#8

Since it’s not the same PHP, it’s obvious something didn’t work.

When you created that softlink, you should be able to cd into it. Do that, and run an ‘ls’ to make sure you see the files. Should be able to just cd /home/user/domain3.com/php-cgi/ and do an ‘ls’ to see the one file: php.cgi

If you can’t, then there’s the problem.

Some questions you still did not answer: Is this under the same user? Same server? If it’s a different user, is the group the same? If not, is the other permissions at least open (755 on php.cgi).


yerba# rm -rf /etc
yerba#


#9

Thanks again guice,

Problem solved.

it was .htacess file
i think i made some mistake, i made it in .txt, upload and rename to .htacess.

I change the way to create .htacess and now is all working.

thanks!