markgoodall
asked on
how to change PHP include
I am setting up an Ubuntu LAMP installation to be used as a test webserver.
When I do "phpinfo();" on the production server, I get:
include_path .:/home/mark/domains/xyz.c om/site_sp ecific
When I do the same on the test server I get:
include_path .:/usr/share/php:/usr/shar e/pear
So I edited the following file:
/etc/php5/apache2/php.ini
and changed the line from this:
;include_path = ".:/usr/share/php"
to this:
include_path = ".:/home/mark/domains/xyz. com/site_s pecific"
I rebooted the test server and did another "phpinfo();" but it didn't change.
What did I do wrong?
When I do "phpinfo();" on the production server, I get:
include_path .:/home/mark/domains/xyz.c
When I do the same on the test server I get:
include_path .:/usr/share/php:/usr/shar
So I edited the following file:
/etc/php5/apache2/php.ini
and changed the line from this:
;include_path = ".:/usr/share/php"
to this:
include_path = ".:/home/mark/domains/xyz.
I rebooted the test server and did another "phpinfo();" but it didn't change.
What did I do wrong?
Oh, and don't forget that there's not a great deal of point changing the value of php.ini settings on a test webserver to suit the paths on the test webserver. You want everything to match the live server (such as your shared hosting account) as closely as possible, otherwise your scripts will work on your test rig, but die with confused errors when you move them onto the live server.
Just something to think about.
Just something to think about.
ASKER
Loaded Configuration File /etc/php5/apache2/php.ini
so I'm pretty sure I'm editting the correct file.
I need to change the php configuration so that it matches the production server exactly.
so I'm pretty sure I'm editting the correct file.
I need to change the php configuration so that it matches the production server exactly.
Are the PHP versions the same?
ASKER
Production Server: PHP Version 5.2.5
Test Server: PHP Version 5.2.10
Test Server: PHP Version 5.2.10
That should be close enough. Have you compared the phpinfo() results from both to see what other differences there are?
ASKER
There are 14 pages of phpinfo() results from each server and I'm not an expert on PHP in the first place, so I'm not sure what I'm looking for. There are many differences, but I'd like to zero in one the important ones that could be causing this.
I think what you're seeing is that the Apache web server is setup on the Production Server to provide each user with their own options and you won't be able to change that in the php.ini for Ubuntu. Unless you change Apache also. They do that to let users customize their setups without affecting the other users.
ASKER
Okay, you've completely lost me now.
My website on the production server is here:
/home/mark/domains/xyz.com /trunk
and it needs to include files that are here:
/home/mark/domains/xyz.com /site_spec ific
The test website on the test server is here:
/home/mark/domains/xyz.com /trunk
and it fails when trying to access included files which are here:
/home/mark/domains/xyz.com /site_spec ific
So I want to make the php.ini files the same on both servers, so that the include path is the same on both servers.
I'm not sure what yuo mean by "to provide each user with their own options". Aren't we talking about the same php.ini files and the same changes to the include_path in that file?
Sorry, but you've confused me.
My website on the production server is here:
/home/mark/domains/xyz.com
and it needs to include files that are here:
/home/mark/domains/xyz.com
The test website on the test server is here:
/home/mark/domains/xyz.com
and it fails when trying to access included files which are here:
/home/mark/domains/xyz.com
So I want to make the php.ini files the same on both servers, so that the include path is the same on both servers.
I'm not sure what yuo mean by "to provide each user with their own options". Aren't we talking about the same php.ini files and the same changes to the include_path in that file?
Sorry, but you've confused me.
Probably not. If it's shared hosting, Apache and PHP are not configured the way they are on your (and my) Ubuntu system. Often users are allowed on shared hosting to have their own 'php.ini' file in their own user area. They're not allowed to change everything but they can do some customization. That function is setup thru the Apache web server. Even on your Ubuntu system (if you installed your server files from Ubuntu), there is more than one 'php.ini' file. One is for the Apache webserver and the other is for comand-line applications.
ASKER
Oh, would this apply to a Ubuntu LAMP Test server (running on an old Dell computer) versus a CentOS Production server runing on a dedicated server?
They could easily be different. 'Dedicated server' usually means that you are the only one on the server (dedicated to you). But the path you showed above is a user/home path that is usually used on 'shared hosting' where there is more than one user on the system. I don't have a CentOS (RedHat derivative) server but they aren't actually 'required' to put things in the same place. The difference between 'dedicated' and 'shared' is more important.
Thinking about it, what files do you have on the production server at '/home/mark/domains/xyz.co m/site_spe cific'?
Thinking about it, what files do you have on the production server at '/home/mark/domains/xyz.co
ASKER
The production server is defintely a dedicated server, defintely not shared hosting server.
I'm familiar with shared hosting, where different companies all share part of one server, and this is defintely not that. I've also setup alot of servers (physical) at Co-Location facilities, and while I can't be sure, I believe this might be the case.
Eitherway, the production server is "dedicated" as far as I can say. I was told to install Ubuntu/LAMP as a test enviroment since that should mimic the production server almost exactly.
All the PHP files are in a folder /home/mark/domains/xyz.com /trunk
For instance:
/home/mark/domains/xyz.com /trunk/ind ex.php
/home/mark/domains/xyz.com /trunk/fro nt_end_cod e/modules/ main.php
There are some includes, mostly related to setting global variables, database, etc, like:
dbconnect.php
globals.php
front_initialization.php
etc
Oh, also the "mark" and "xyz.com" are made up for posting here as the real values related directly to a real company.
I'm familiar with shared hosting, where different companies all share part of one server, and this is defintely not that. I've also setup alot of servers (physical) at Co-Location facilities, and while I can't be sure, I believe this might be the case.
Eitherway, the production server is "dedicated" as far as I can say. I was told to install Ubuntu/LAMP as a test enviroment since that should mimic the production server almost exactly.
All the PHP files are in a folder /home/mark/domains/xyz.com
For instance:
/home/mark/domains/xyz.com
/home/mark/domains/xyz.com
There are some includes, mostly related to setting global variables, database, etc, like:
dbconnect.php
globals.php
front_initialization.php
etc
Oh, also the "mark" and "xyz.com" are made up for posting here as the real values related directly to a real company.
The files you're listing in 'trunk' are not the 'normal' PHP includes but user files. On both my Ubuntu and Windows systems, the "include_path" leads to PHP language extensions, not user files.
Is some kind of PHP based 'framework' installed on the production server?
Is some kind of PHP based 'framework' installed on the production server?
ASKER
I'm sorry the "trunk" folder name is used on the SubVersion repository server for this system. That folder is really named "public_html".
Yes, it seems like some sort of PHP framework for a content management driven system with it's own adminkit.
I was given a copy of the phpinfo() from the production server and told to use that to help setup the test server. The PHP system fails with error messages saying it can't find the files that are located in the /site_specific folder. If I go and alter the PHP file and add that path to the include_path, then it finds it. However, there are dozens (if not more) PHP I'd have to change to make this work, which isn't feasible. I know I have add it to the system include_path to make it work without having to alter all the PHP files.
I just can't figure out why the phpinfo() on the test server doesnt' reflect the change that I made.
Yes, it seems like some sort of PHP framework for a content management driven system with it's own adminkit.
I was given a copy of the phpinfo() from the production server and told to use that to help setup the test server. The PHP system fails with error messages saying it can't find the files that are located in the /site_specific folder. If I go and alter the PHP file and add that path to the include_path, then it finds it. However, there are dozens (if not more) PHP I'd have to change to make this work, which isn't feasible. I know I have add it to the system include_path to make it work without having to alter all the PHP files.
I just can't figure out why the phpinfo() on the test server doesnt' reflect the change that I made.
I'd try installing the CMS on your test server and see if that changes the settings.
ASKER
That's what I'm doing... I'm trying to install it on the test server.
It's not a CMS that you "install", it's a huge PHP website that draws a certain amount of it's content from a MySQL database, and part of the PHP code is the adminkit that let's the administratiors add data to the database.
I was told to:
Install LAMP on a Ubuntu system.
Configure PHP acording to the info from the phpinfo() sheet from the production server
Copy all the PHP files to the test server
Create the MySQL database based on a .sql file generated from the production database
It's not a CMS that you "install", it's a huge PHP website that draws a certain amount of it's content from a MySQL database, and part of the PHP code is the adminkit that let's the administratiors add data to the database.
I was told to:
Install LAMP on a Ubuntu system.
Configure PHP acording to the info from the phpinfo() sheet from the production server
Copy all the PHP files to the test server
Create the MySQL database based on a .sql file generated from the production database
What are you supposed to do then?
ASKER
I will have a fully functioning test server.
Then the changes I make in DreamWeaver can be copied(FTP) to the test server, I can access the test server with IE and make sure it looks/functions as expected, then I can commit the changes to the SVN repository server and update the production server with the changed php files.
Then the changes I make in DreamWeaver can be copied(FTP) to the test server, I can access the test server with IE and make sure it looks/functions as expected, then I can commit the changes to the SVN repository server and update the production server with the changed php files.
Hi!
Maybe you could make a backup of your production server, make a clean install of the test server and then restore the backup to the test server? Sounds like the easiest way to set up an identical test environment.
Regards, Tobias
Maybe you could make a backup of your production server, make a clean install of the test server and then restore the backup to the test server? Sounds like the easiest way to set up an identical test environment.
Regards, Tobias
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well it's still not working... no solution I guess :(
Possibly you edited a php.ini file which is not the one being used by your PHP executable. (Sometimes you find your machine littered with files that are more or less identical, but only one is actually in use.)