Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Wednesday, 8 August 2007

PHP and the require_once() function to name one issue

I have been battling for a number of months to try and get WebPA into a state so that it will work when installed on any platform. My first steps have been to try and remove all of the $_SERVER['DOCUMENT_ROOT'] references and replace them with relative links. I wanted everything to be linked relatively as you can then take a web application from one server and place it on to another with out having to go through all of the code to make it work. Yes I know that PHPites like to use the inbuilt server variables where possible, which can be good, but in the case of porting an application to a Microsoft based architecture will cause all kind of problems.

Once I changed all of the code to relative links, everything began to go wrong. But it appears that it is not just going wrong for me, this appears to be a common problem with PHP. If you do a Google search you will come up with a plethora of similar postings where people are suffering similar problems. At the moment I am trying to find a solution to the problem. I need to locate a work around that will suffice as WebPA needs to be easy to install, even by some one with little to no technical knowledge. My solution has been to user ‘./’ (dot forward-slash) to take me directly to the application root, load the global include file on its path and then, as others do, define my own DOC__ROOT. But am I there am I hell.


Although I get the login page on a WAMP and also on the MAMP set-ups, when I try to login then I get the same error message. However, when I run everything on a LAMP set-up, I get a completely different error all together. Well saying that all the errors are all related again to the require_once function in PHP.

Eventully I found the solution thanks to the folks who post fixes on the php manual pages. It isn't the most elegent of solutions, but it works. As of today I can say WebPA will work on all configurations that I can think of.

Tuesday, 31 July 2007

What has happened to July

OK we are on the last day of the month and usually by this point I will have posted as many as four posts, but as you can see this month is some what lacking. Well there is a good reason for this, as many of you know me will know that I have been really ill over the past few weeks. I seem to be on the mend again and have made it back into work.

However, nothing has been static on the project! In my absence Paul Newman has stepped in and more or less saved the day. As a result we have been able to send off a copy of WebPA to the University of Derby. The University of Derby are our first pilot institution. As I find out how they are doing with the installation of the system I will of course post information to here.

Getting this far has not been an easy road though. Some of the major barrier have not been to do with the systems code but rather with PHP itself. One problem in PHP is related to the inclusion of files. Within WebPA we use 'require_once' which is built on include. However, their is a problem including files with the relative path. As WebPA needs to be cross platform this has been a serious issue. PHP has been corrected for the latest release, but we as a project can not guarantee that everyone will be using this. At the moment we seem to be able to make thing work. At present I have WebPA running on the MacBook Pro, but not within the local user sites area. Once I have this fixed, I will try the code on the LAMP server and then on a machine I have set up at home running WAMP. Once I am certain that the system is working on all the architecture configurations that I can easily lay my hands on then I will make a public release available via the projects sourceforge page.

As for sourceforge, I'm still not convinced that this is the best location to serve the projects downloads from (see an earlier post). I am watching the Simal project as they are using the Google code tool and I can always ask them how it is going. But as of yet I am still to find an alternative (apart from hosting a suite of tools here at Loughborough).

One other thing that has happened in my absence is that the project has visited another potential pilot institution. However, as expected we are faced with some institutional barrier. These barriers include; academic uptake of the tool, availability of server space and skills to implement the system locally. Due to this we may need to look at approaching other institutions with in England, where there is less of a barrier to adoption. For now though I will have to return to doing my day to day work and get the system out, as we need to 'release early, release often!'