NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Pre Purchase Question


Joined: 10 Oct 2011
Posts: 8
Reply with quote
Hi
OK a bit about me first - I am a hobby programmer and I run a free website with about 3500 members currently, the site is vbulletin 3.7 based though it has a lot of modifications, most of which I programmed myself

I do all the programming work on my site (php and javascript) and work alone on it in my spare time

I would like to know if phped would be suitable for me

Here is how I am currently working

I have a test version of my site running on one PC on my LAN using apache server/php5/mysql

I do my programming on another PC using Dreamweaver CS3

I use a few plugins for Mozilla Firefox - namely FirePHP, FireBug Web Developer and Venkman Javascript debugger to debug my code

Because my live website has rather a lot of absolute links in the database and code ) like www domainname com/blah blah and because I have no idea how to make a local test site work properly (please bear in mind I've only been doing this stuff 18 months and am self taught) I had to edit a lot of html, php files and vbulletin templates etc to get the test version of the site to run (replacing domainname.. with http://localhost..) This does work well enough for me to develop and debug my code but it's a right royal pain in the butt because

a: if I try to access from another PC on my LAN then a lot of stuff then does not work (as I am now entering http://192 168 1 3 instead of http://localhost

b: When I do develop new features for my site I often have to re edit them and change references of localhost to domainname before I upload them - and sometimes I forget! So it is almost impossible for me to keep the test site and live site synchronised.

So I am looking for a way around these problems

My first and biggest question is would phpEd allow me to take a full backup of my live site and run it in the integrated local test server without changing all the references from domain name to localhost?

And if not is there some other way around this that would achieve the same result

I have played around a bit with the trial of php ed a year or so ago but I could never get the remote debugger thing to work at that time - however my skills and knowledge have improved a bit since then so I would like to have another go

best regards
Rich


Last edited by dicky96 on Mon Oct 10, 2011 12:58 pm; edited 2 times in total
View user's profileFind all posts by dicky96Send private message
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
With all of the PHP sites that I develop, they can be easily copied to a new server and used with any domain name. I then know I won't have any problems moving between development, staging and production.

I never use localhost as a domain name for web site development as I find it causes various issues. For example, a lot of community PHP code (eg CMS systems) will not work with localhost (a lot of domain related code requires dots in the domain name), having to use sub-folders for each site to keep them separate, problems with cookies and it can also be very untidy.

You should find it possible to develop a web site without any internal fixed references to the domain name and using internal fixed references would almost certainly be considered bad design. For example, the site could use /page.php instead of http://www.domain.com/page.php and then the browser would use whatever domain was being visited. However, you might not be able to do that if you are using localhost with a sub-folder for the development site. Get away from using localhost, then you can stop using sub-folders for each site. You will need to learn a little bit about Apache configuration to do that, but it can be easy.

Another option is the Windows hosts file, which is normally stored somewhere like c:\windows\system32\drivers\etc\hosts and is just a text file that maps domain names to IP addresses. So you could for example assign www.domain.com to 127.0.0.1 and that will then bypass DNS. You can also uses hosts to create your own internal domain names, such as mywebsite.local (always have at least one dot in your own domain names).

PhpED has really useful FTP features for updating sites, etc. but it is not a backup application. You might find a full FTP application better, such as FileZilla (free and good) or SmartFTP (my personal favourite). Backing up databases could be done with a bit PHP code on the server to create a dump file, which you can transfer with FTP. There are even PHP scripts around that will dump the database and files into a compressed archive, so you can transfer just a single file with FTP (much faster).

If you are using DreamWeaver to develop PHP, good luck! Rolling Eyes I used to love DreamWeaver, but I hate it these days. I use PhpED for nearly everything and don't even find much of a use for visual design tools. I find it better with something like Firefox with FireBug and then adjusting CSS. The results are consistently better across different browsers.

Once you get the PhpED debugger working, you will hopefully find it quite liberating and it will make your development and learning much easier.

The answer to your final question is YES, it is perfectly possible for PhpED to run a copy of a live site locally with a debugger and no changes, as long as you fix the issues with your domain name usage. However, PhpED comes with both an integrated web server called SRV and also the ability to work with the Apache web server with the PhpED debugger. Stick with Apache because I found SRV does not give a compatible web environment compared with Apache.
View user's profileFind all posts by plugnplaySend private message


Joined: 10 Oct 2011
Posts: 8
Reply with quote
HI thanks for the reply

OK to clarify my live website does not have any references to localhost but it does have a lot of references to the absolute domain name for things like links to gif files and on the navigation bar etc. Things like www. domain .com/ images/ whatever.gif in href and img tags etc. The only way I got a test version of the site running locally on my currect setup was to edit all these absolute links to say localhost/ instead of domain com.

This is most certainly due firstly to another programmer who I originally paid to work on the site who should have known better, and also down to me who started from nowhere 18 months ago so didn't know better about using relative links and didn't know any other way to get my test site working other than change the links to localhost instead

It has occurred to me either I need to go through all the php, html files and custom templates (stored in the database) and change all the absolute links to relative ones - I guess I could use 'Actual Search and Replace' to find them all - the ones in the database I could find them in a sql backup, edit them and then restore it or use phpmyadmin to change them?

The other option I guess would be this windows hosts file you mentioned. Let me just get this straight in my head, am I right in assuming that would stop the PC running the apache server from accessing the live site and 'redirect' www domain com to the localhost 127.0.0.1 instead when I use a browser on that PC? So I enter the domain name as normal but end up connecting to my local server and test site?

From the two I guess changing all the absolute links I introduced to relative ones would really be the best way to resolve my problem, though a little time consuming?

Regards FTP programs I use WinSCP to upload to my live site - don't know how it compares with your favourite but it certainly works for what I need it to do

Thanks
Rich
PS whay do I have to put spaces into things like www domain com to get them to display here otherwise I see yellpw triangles with ! in them - but in your answer you obviously don't have this problem?
View user's profileFind all posts by dicky96Send private message
Guru master

Joined: 24 Jul 2009
Posts: 737
Reply with quote
Hi,

It sounds like you are thinking along the correct tracks Smile Exporting/dumping SQL, editing it and importing it can be a very convenient way of fixing up a database. Changing absolute to relative would probably be your best long term approach.

On Windows the hosts file allows an IP address to be assigned to a domain name at a very low level, so most if not all software on that Windows computer would use 127.0.0.1 instead of the real address. Indeed, you will normally find that file contains the assignment for localhost! Bear in mind that most web browsers cache IP addresses within the browser for a period of time, so you might need to restart any running browsers.

This forum used to get a lot of spam and still gets the occasional ones. It limits 'features' according to the number of posts you've made. After you've done a few posts you will be able to post web addresses, links, etc.
View user's profileFind all posts by plugnplaySend private message


Joined: 10 Oct 2011
Posts: 8
Reply with quote
Right then - With that in mind, I'm going to take an up to date backup of my entire stes files/folders, plus a database backup and see that I can do with these absolute links

Once I have that running I'll be back asking how to set up phped to work with my test site



Thanks
Rich
View user's profileFind all posts by dicky96Send private message
Pre Purchase Question
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic