Hi all,
I've got PCG to work on my local Windows/Apache server, generated the framework code, initially working with an includes directory in PHP and now with .htaccess; and then, using .htaccess in the root of the generated code too. So, I've got to the next step of checking that I can run the generated code on a real live server, before I attempt to make changes that will affect the HTML and turn it into 'my' site.
I uploaded the generated files, made a few changes and made sure the permissions are OK as it's a Linux/Apache setup. And it doesn't work!
It's been a week or two now and I've just got deeper in mire of confusion. Do I have to actually upload the whole of phpCodeGenie, or just the generated files?
Perhaps some kind soul would detail what has to be uploaded and, critical this, what amendments have to be made to the generated files so it can work in the new environment?
Thanks
Andy
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Andy,
You might try setting up a secondary "localhost" that is closer to the live server.
It's easy to do and it may or may not have anything to do with permissions. More than likely its PATH than permissions.
Try this.
1) edit the \windows\system32\drivers\etc\hosts file and add at least one line that says something like:
127.0.0.2 localhost2
2) edit your apache httpd.conf file and add a section (probably at the BOTTOM of the file) something like this:
<VirtualHost localhost2:80>
DocumentRoot "C:/Data/Applications/localhost2"
ServerName localhost2
<Directory "C:/Data/Applications/localhost2">
Options Indexes +Includes +FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
3. Be sure you have an actual directory such as "C:/data/applications/localhost2". It can be anything you want, this is just what I use for multiple development on WinXP.
4. Restart Apache.
5. Create a "test.php" file in the directory above in your new virtual host. The file is just:
It should show you what your current configuration is.
7. Now create a test.php on your target server and determine what Apache/PHP sees as your include_dir. Hopefully it will be "normal". Assuming it is normal, then emulate your target host with your localhost by creating a directory similar to what your home directory is on your hosted environment. If its Linux, it might be something like:
/home/your_id/www or whatever.
So create a directory on your C: drive like C:\home\your_id\www
8. Change/create your .htaccess file to point to whatever directory you are emulating.
9. Check to see what your test.php shows. It should show local and global for include_path and they will be different if you've done your work correctly.
10. Now copy just the GENERATED stuff to your c:\data\applications\localhost2 directory structure.
11. Test it. If it doesn't run, it will show you where the problems are and you just adjust your .htacess till you get it.
12. Copy it (don't MOVE) to your live host.
13. Test and adjust as needed.
I've probably left out some steps but if you can simulate locally, it will save pulling a few hairs or abusing whatever! :lol:
Post or do some private messaging if you get too frustrated.
It's hard but not impossible to prototype on Windows and have the code run on *NIX. And of course, you have to be VERY careful with UPPER/lower case file names and avoid spaces in file names when you port to *NIX.
Good luck and best regards.
Dave Nuttall
San Antonio, TX
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Dave,
I'll certainly do what you suggest although, it may be a week or so before I can report success. (Hopfully!) I'll try and stick to just posting on the forum if possible, so anyone else can see what's beng done.
I've taken note of what you said about just using the generated files (by copying) as that was one thing that I really wondered about.
Do you know of a live site that we could look at that was made with PCG?
Regards
Andy
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I go as far as step 7. before things stopped going like they're supposed to!
test.php does not elicit an 'include_dir' at all either on locahost2 or on the targethost. There is just 'include_path' which on:
localhost2 is .;C:\php5\pear in both Local & Master columns ans;
targethost is .:/usr/lib/php:/usr/local/lib/php also on Local & Master columns.
Anyway I've gone on to make a directory in localhost2, same as targethost DOCUMENT_ROOT ie: /home/my_id/public_html and tried using that in a .htaccess file but it didn't work and also, where should I put the .htaccess as it's not until step 10 that I would put the generated files into my localhost2 root directory structure (same as your c:\data\applications\localhost2 directory structure, mine is just c:/localhost2)
Regards
Andy
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
[This a revision (version 1.1?!) of Dave's original posted advice, modified by Andy and Dave in email contacts and to reflect Andy's particular experience. But it did actually all work! See it for a while anyway: http://www.jagsfamily.com/jagsfami_akguestbook/web\]
Anyway here's what to do:-
You might try setting up a secondary "localhost" that is closer to the live server.
It's easy to do and it may or may not have anything to do with permissions. More than likely its PATH than permissions.
Try this.
1) edit the \windows\system32\drivers\etc\hosts file and add at least one line that says something like:
127.0.0.2 localhost2
2) edit your apache httpd.conf file and add a section (probably at the BOTTOM of the file) something like this:
<VirtualHost localhost2:80>
DocumentRoot "C:/Data/Applications/localhost2"
ServerName localhost2
<Directory "C:/Data/Applications/localhost2">
Options Indexes +Includes +FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
3. Be sure you have an actual directory such as "C:/data/applications/localhost2". It can be anything you want, this is just what I use for multiple development on WinXP.
4. Restart Apache.
5. Create a "test.php" file in the directory above in your new virtual host. The file is just:
It should show you what your current configuration is.
7. Now create a test.php on your target server and determine what Apache/PHP sees as your include_path. Then emulate your target host with your localhost by creating a directory similar to what your HOME directory is on your hosted environment. If its Linux, it might be something like:
/home/your_id/www or whatever.
So create a directory on your C: drive like C:\home\your_id\www and also edit your Apache httpd.conf file again so the VirtualHost localhost2 DocumentRoot is “C:\home\your_id\www” and <Directory “c:/home/your_id/www"> conforms with the revised DocumentRoot.
8. Change/create your .htaccess file in the DocumentRoot to point to whatever directory you are emulating. This means .htaccess now points to itself!
9. Check to see what your test.php shows. It should show local and global for include_path and they will be different if you've done your work correctly.
10. Now copy just the GENERATED stuff to your c:\data\applications\localhost2 directory structure. You need to have another .htaccess file in the generated files root directory that points to its 'include' directory
11. Test it. If it doesn't run, it will show you where the problems are and you just adjust your .htacess till you get it.
12. Copy it (don't MOVE) to your live host. You then need to use the webserver's control panel (or edit&then ftp upload) to edit the your_dbname.conf.php file to conform with things like web URL, user/password, etc. so it conforms to the webserver's environment
13. Test and adjust as needed. When Andy mounted it all on a Linux/Apache live webserver, it was also necessary to edit the definition of FILE_SEPARATOR, from "\\" to"/" and also change the \\ to / in the SITE_PATH definition string of your_dbname.conf.php, then it worked!
I've probably left out some steps but if you can simulate locally, it will save pulling a few hairs or abusing whatever! :lol:
Post or do some private messaging if you get too frustrated.
It's hard but not impossible to prototype on Windows and have the code run on *NIX. And of course, you have to be VERY careful with UPPER/lower case file names and avoid spaces in file names when you port to *NIX.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I've got PCG to work on my local Windows/Apache server, generated the framework code, initially working with an includes directory in PHP and now with .htaccess; and then, using .htaccess in the root of the generated code too. So, I've got to the next step of checking that I can run the generated code on a real live server, before I attempt to make changes that will affect the HTML and turn it into 'my' site.
I uploaded the generated files, made a few changes and made sure the permissions are OK as it's a Linux/Apache setup. And it doesn't work!
It's been a week or two now and I've just got deeper in mire of confusion. Do I have to actually upload the whole of phpCodeGenie, or just the generated files?
Perhaps some kind soul would detail what has to be uploaded and, critical this, what amendments have to be made to the generated files so it can work in the new environment?
Thanks
Andy
Andy,
You might try setting up a secondary "localhost" that is closer to the live server.
It's easy to do and it may or may not have anything to do with permissions. More than likely its PATH than permissions.
Try this.
1) edit the \windows\system32\drivers\etc\hosts file and add at least one line that says something like:
127.0.0.2 localhost2
2) edit your apache httpd.conf file and add a section (probably at the BOTTOM of the file) something like this:
<VirtualHost localhost2:80>
DocumentRoot "C:/Data/Applications/localhost2"
ServerName localhost2
<Directory "C:/Data/Applications/localhost2">
Options Indexes +Includes +FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
3. Be sure you have an actual directory such as "C:/data/applications/localhost2". It can be anything you want, this is just what I use for multiple development on WinXP.
4. Restart Apache.
5. Create a "test.php" file in the directory above in your new virtual host. The file is just:
<?php echo phpinfo(); ?>
6. Hit it with ur browser: http://localhost2/test.php
It should show you what your current configuration is.
7. Now create a test.php on your target server and determine what Apache/PHP sees as your include_dir. Hopefully it will be "normal". Assuming it is normal, then emulate your target host with your localhost by creating a directory similar to what your home directory is on your hosted environment. If its Linux, it might be something like:
/home/your_id/www or whatever.
So create a directory on your C: drive like C:\home\your_id\www
8. Change/create your .htaccess file to point to whatever directory you are emulating.
9. Check to see what your test.php shows. It should show local and global for include_path and they will be different if you've done your work correctly.
10. Now copy just the GENERATED stuff to your c:\data\applications\localhost2 directory structure.
11. Test it. If it doesn't run, it will show you where the problems are and you just adjust your .htacess till you get it.
12. Copy it (don't MOVE) to your live host.
13. Test and adjust as needed.
I've probably left out some steps but if you can simulate locally, it will save pulling a few hairs or abusing whatever! :lol:
Post or do some private messaging if you get too frustrated.
It's hard but not impossible to prototype on Windows and have the code run on *NIX. And of course, you have to be VERY careful with UPPER/lower case file names and avoid spaces in file names when you port to *NIX.
Good luck and best regards.
Dave Nuttall
San Antonio, TX
Thanks Dave,
I'll certainly do what you suggest although, it may be a week or so before I can report success. (Hopfully!) I'll try and stick to just posting on the forum if possible, so anyone else can see what's beng done.
I've taken note of what you said about just using the generated files (by copying) as that was one thing that I really wondered about.
Do you know of a live site that we could look at that was made with PCG?
Regards
Andy
I go as far as step 7. before things stopped going like they're supposed to!
test.php does not elicit an 'include_dir' at all either on locahost2 or on the targethost. There is just 'include_path' which on:
localhost2 is .;C:\php5\pear in both Local & Master columns ans;
targethost is .:/usr/lib/php:/usr/local/lib/php also on Local & Master columns.
Anyway I've gone on to make a directory in localhost2, same as targethost DOCUMENT_ROOT ie: /home/my_id/public_html and tried using that in a .htaccess file but it didn't work and also, where should I put the .htaccess as it's not until step 10 that I would put the generated files into my localhost2 root directory structure (same as your c:\data\applications\localhost2 directory structure, mine is just c:/localhost2)
Regards
Andy
[This a revision (version 1.1?!) of Dave's original posted advice, modified by Andy and Dave in email contacts and to reflect Andy's particular experience. But it did actually all work! See it for a while anyway: http://www.jagsfamily.com/jagsfami_akguestbook/web\]
Anyway here's what to do:-
You might try setting up a secondary "localhost" that is closer to the live server.
It's easy to do and it may or may not have anything to do with permissions. More than likely its PATH than permissions.
Try this.
1) edit the \windows\system32\drivers\etc\hosts file and add at least one line that says something like:
127.0.0.2 localhost2
2) edit your apache httpd.conf file and add a section (probably at the BOTTOM of the file) something like this:
<VirtualHost localhost2:80>
DocumentRoot "C:/Data/Applications/localhost2"
ServerName localhost2
<Directory "C:/Data/Applications/localhost2">
Options Indexes +Includes +FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
3. Be sure you have an actual directory such as "C:/data/applications/localhost2". It can be anything you want, this is just what I use for multiple development on WinXP.
4. Restart Apache.
5. Create a "test.php" file in the directory above in your new virtual host. The file is just:
<?php echo phpinfo(); ?>
6. Hit it with ur browser: http://localhost2/test.php
It should show you what your current configuration is.
7. Now create a test.php on your target server and determine what Apache/PHP sees as your include_path. Then emulate your target host with your localhost by creating a directory similar to what your HOME directory is on your hosted environment. If its Linux, it might be something like:
/home/your_id/www or whatever.
So create a directory on your C: drive like C:\home\your_id\www and also edit your Apache httpd.conf file again so the VirtualHost localhost2 DocumentRoot is “C:\home\your_id\www” and <Directory “c:/home/your_id/www"> conforms with the revised DocumentRoot.
8. Change/create your .htaccess file in the DocumentRoot to point to whatever directory you are emulating. This means .htaccess now points to itself!
9. Check to see what your test.php shows. It should show local and global for include_path and they will be different if you've done your work correctly.
10. Now copy just the GENERATED stuff to your c:\data\applications\localhost2 directory structure. You need to have another .htaccess file in the generated files root directory that points to its 'include' directory
11. Test it. If it doesn't run, it will show you where the problems are and you just adjust your .htacess till you get it.
12. Copy it (don't MOVE) to your live host. You then need to use the webserver's control panel (or edit&then ftp upload) to edit the your_dbname.conf.php file to conform with things like web URL, user/password, etc. so it conforms to the webserver's environment
13. Test and adjust as needed. When Andy mounted it all on a Linux/Apache live webserver, it was also necessary to edit the definition of FILE_SEPARATOR, from "\\" to"/" and also change the \\ to / in the SITE_PATH definition string of your_dbname.conf.php, then it worked!
I've probably left out some steps but if you can simulate locally, it will save pulling a few hairs or abusing whatever! :lol:
Post or do some private messaging if you get too frustrated.
It's hard but not impossible to prototype on Windows and have the code run on *NIX. And of course, you have to be VERY careful with UPPER/lower case file names and avoid spaces in file names when you port to *NIX.