raman Posted July 14, 2010 Share Posted July 14, 2010 I have a server on which I have 4 websites, now I have to shift all of these to a different server. However, the paths of many directories and programs etc. are set up individually in each php script and the processing perl scripts. So I shall have to go through each file of each website to set the things working again. because earlier the path was /usr/local/apache2/htdocs now it is /var/www/html and there are many such paths. This time I want to create a single file containing all the paths, so that next time if the server is shifted, it would require only a single file to be amended rather than each file. Can someone suggest how to do this for PHP and perl scripts both suh that I may include the file containing paths in both PHP and perl scripts. I have checked the PHP include function, include 'paths.php'; but how can I include PHP script in a PERL script. Please help. Quote Link to comment https://forums.phpfreaks.com/topic/207686-how-to-create-environment-file/ Share on other sites More sharing options...
ocpaul20 Posted July 14, 2010 Share Posted July 14, 2010 Cant' you reference them all from document root and so you do not have to individually code each one? Then you just have to say that images are kep in the pics directory, include files in the inc directory or whatever. Of course, that way you would have to set up the structure of your website each time, but that would need to be done anyway. Quote Link to comment https://forums.phpfreaks.com/topic/207686-how-to-create-environment-file/#findComment-1085709 Share on other sites More sharing options...
raman Posted July 14, 2010 Author Share Posted July 14, 2010 Can you elaborate in detail what do you mean and how to do this? What is root document? Quote Link to comment https://forums.phpfreaks.com/topic/207686-how-to-create-environment-file/#findComment-1085715 Share on other sites More sharing options...
raman Posted July 14, 2010 Author Share Posted July 14, 2010 I understand that the Document root is the directory in which one keeps all the web directories, but how do i reference the paths from there ? Quote Link to comment https://forums.phpfreaks.com/topic/207686-how-to-create-environment-file/#findComment-1085717 Share on other sites More sharing options...
Adam Posted July 14, 2010 Share Posted July 14, 2010 You can generate the root path with: $root_path = dirname(__FILE__); Quote Link to comment https://forums.phpfreaks.com/topic/207686-how-to-create-environment-file/#findComment-1085725 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.