I didn't want to have to ask for help, but I think I have to..

I have a dedicated linux server. I am hosting several sites on one IP.

I am trying to replicate one particular site and am having a problem which is either permissions related or include-path related.

When I look at the phpinfo() for the original site and the copied site, they are virtually identical, but one main difference is the original site has a different include_path.

But when I access the server's etc directory and vi the php.ini file, the include_path doesn;t match either the copied or original. Its just commented out

I checked the httpd.include file and it references the conf folder in the original directory as if there are more include commands there but I can not access it or change the persmissions or anything.

Is there another file specific to each website to update include paths? Am I making any sense?

    Where's the location of php.ini according to phpinfo()?

      it says /etc/php.ini

      I am hesitant to make changes to that file. The original site has a different include_path than the copied site, and neither is equal to the setting in that php.ini file.

      So if I am hosting a number of php sites on one linux server, all the individual sites don't share the same php.ini file right? There must be php.ini files specific to each website. or am I wrong?

      And all I really need to find is the location of the include_path settings for the individual sites, not the main server. But everywhere I am led seems to be a folder I do not have permissions to access. For example, I think the solution might be in the httpdocs/conf folder but I can't get in there..

      Any help or suggestions would be greatly appreciated.

        No, every installation / compilation of PHP should have it's own php.ini file, but all sites that are on your server should use the same install of PHP.

        Each site uses the same install of Apache (or LightTPD or IIS), but can have different .htaccess files per folder.

        Server and PHP configs are global to the server. Not one per site. Set the include path correct for your server and you should be fine. If you don't set this right, certain files won't be included properly.

          I completely understand. However, each site has a unique path I need to include. The sites are not sharing the same files. For example.

          The original site and copied sites all have an admin section and an include folder within it.

          site.com/admin and site.com/admin/inc.

          If I set the main php.ini file on the server, all sites will point to the same website, not each unique websites include path.

          for example.. i want site1 to have :/var/www/vhosts/site2.com/admin/inc/: and site2 to show :/var/www/vhosts/site2.com/admin/inc/:

          If I change the servers main php.ini file to :/var/www/vhosts/site1.com/admin/inc/: , then won't that copy to site2 and so on?

          If each site is given a unique php.ini, where is it?

            then use .htaccess to set the path for each site.

            Google for Matt Zandstra and read up on the article "Death to the Dot" over at getinstance.com

            If you read the article, as well as some of the notes (by me 😉) you'll see how to fix this using a .htaccess for each site you operate. Just leave the php.ini include path to the global includes.

              Thanks! This is exactly what I am looking for. My only other question would be where is the ideal location to store the .htaccess file?

                Typically in the root of their folder. /usr/username/public_html/.htaccess

                Typically that's the best spot just so that it applies to all sub-directories.

                  I am so close to the finish line, I can feel it. But I am stumped again and could use some more help.

                  Everything works fine now except for the Excel file export.
                  On the original site, when I click export, not only does it update the database to show the data was exported, but it also puts an .xls file on the server.

                  On the replicated site however, it chokes on the export. No file is exported and the database is not updated.

                  When I remove ALL the export file related code, it updates the dbase successfuuly.

                  I have tried changing the permissions of the export folders on the replicated site, thinking the server wasn't allowing the file to be written, but after changing them, still no luck.

                  The export.php file contains some PEAR instructions. I am wondering if this is the source of my frustrations. But, the include path for :/usr/share/pear is set right I believe.

                  Any suggestions?

                    Is pear installed / compiled on the server?

                      PEAR is definately installed on the server

                      All domains are on the same linux server.

                      Site1 functions fine including XLS export
                      (All built before me)

                      Site2 functions fine including XLS export
                      (I built the dbase and installed all the files in the httpdocs, but the domain was created before me)

                      Site3 functions fine EXCEPT the XLS export. I created it from domain up.

                      So something is set on the first two sites which I am missing. I tried messing with the file permissions of the export directory and I do not think it is a permissions issue.

                      The include path includes the pear folder, but is it definately PEAR or could it be a permissions or ownership issue?

                        check this out...

                        Warning: processexport(Spreadsheet/Excel/Writer.php): failed to open stream: No such file or directory in /var/www/vhosts/ahm-nj.com/httpdocs/admin/inc/php/functions.php on line 189

                        Fatal error: processexport(): Failed opening required 'Spreadsheet/Excel/Writer.php' (include_path='.:usr/share/pear:/var/www/vhosts/ahm-nj.com/httpdocs/admin/inc/php') in /var/www/vhosts/ahm-nj.com/httpdocs/admin/inc/php/functions.php on line 189

                        check out my include path in the error message...
                        B[/B]

                        i turned on display errors which i should have done hours ago.. Clearly, the new site isn't finding pear. Any idea why?

                          Is that where pear is installed? have you enabled the extension for it?

                            I am not sure what you mean by "enable the extension"

                            I added:
                            ini_set('include_path' ,ini_get('include_path').':/usr/share/pear/:');

                            to the line above: require_once "Spreadsheet/Excel/Writer.php";

                            and the thing worked!

                            I guess I can leave that in there and just put this to rest, but I want to know why its not working the way it should..

                            the path usr/share/pear is correct in the include and that is where the files are located. I verified everything's location/path on the server.

                            so if the right path is in the include_path setting and all the files are in the right place, and it works on two other domains, what am I missing?

                            If that one line of code solves the problem, can you tell where I went wrong or what I am overlooking?

                              You're missing the trailing slash in your .htaccess file...

                              :usr/share/pear
                              versus
                              :/usr/share/pear/

                              Add the trailing slash and it should work.

                                Write a Reply...