unable to get c0ommand line/any OTHER way?
Archived from the Xataface Developers forum.
PapaLion — Mon Jul 07, 2008 8:45 am
I just spoke to my server host, a shared server, EZ 4 me… happy with them BUT… SSH is not available to me/no PuTTy etc NO command line available to me. So….I cannot do step 3…~ makesite ~ from command line? So… how ELSE might I install and configure the Xataface into a directory of mysite.com. Open to ideas, changing the host is probably NOT an option as I am content in every other way and have some time ivested with them, the are national co.
thanks much for ideas?
PapaLion
shannah — Mon Jul 07, 2008 9:36 am
Proceed to the manual installation instructions. The makesite script is just a convenience script. Personally I never use it. I just set up the files manually because it’s so quick.
PapaLion — Mon Jul 07, 2008 2:02 pm
thanks much… will do this eve. Good 2 know there is another way in.
PapaLion — Mon Jul 07, 2008 3:53 pm
This last idea seems to be working better.
I have mkdir ‘FacultyOfWidgetry’ ? do I place this parallel to the extracted program folder or interior to it?
mysite/directory/Faculty or mysite/directory/xatabase1.0beta3/Faculty
I ask this because I am not getting a good grasp of exactly how the index.php would find my Faculty database? I used phpAdmin and I created FacultyOfWidgetry data base with username:Xata, password: AYXata1.
So… I am not correctly entering the pathways in index.php or conf.ini or BOTH? and/or not filling out the conf.ini ~database~ portion correctly? Or just being a li’l dense? I dunno a,b,c, or all of above?
thanks if U can easily point me to any light here in this tunnel:)?
PapaLion — Mon Jul 07, 2008 9:17 pm
mysite/directory/FacultyOfWidgetry/index.php yields Internal Server Error 505. I cannot decipher a correct directory placement for the files and then edit the index and init files path and names to assure myself it is looking for the DB at all. I randomly tried several choices but can’t find a way to check it. logs? error msgs? It might be helpful to others
I found 2-3 other similar Googled ?s like mine… “how do you install it manually?” Maybe, show a few examples for folks not well versed in PHP/MySQL DB format please of successful file entry (index, init) for a remote server?
I’m going to bed… might look at it again, I could USE this program if I could go past trying to get one makefile edited to work? sheesh!:) this is NOT the fun part now is it?
shannah — Mon Jul 07, 2008 11:23 pm
I have mkdir ‘FacultyOfWidgetry’ ? do I place this parallel to the extracted program folder or interior to it?
You can place this anywhere on your web server, so long as it is web accessible (i.e. you can point your web browser to it).
It doesn’t have to be located in the xataface folder, nor does the xataface folder have to be located in your application folder. The path and url to the xataface folder are specified in your index.php file.
What does your index.php file look like?
What does your conf.ini file look like?
An internal server error could be anything*. You really need to check your logs. (I’m not familiar with your web host so I can’t be much of a help in how your web host make your logs available to you. Normally the log files in Linux/Unix are at /var/log/httpd/error_log.
* Some common things that might cause an internal server error include:
Bad file permissions on a script
.htaccess file options that aren’t allowed by your server
One thing to check before you get too far is whether your web server is running PHP in safe mode. Xataface doesn’t work well with safe mode.
-Steve
shannah — Mon Jul 07, 2008 11:30 pm
Maybe, show a few examples for folks not well versed in PHP/MySQL DB format please of successful file entry (index, init) for a remote server?
Perhaps when you get this sorted out you can write a short tutorial. I have tried to make the documentation as clear as possible, but a new perspective can be helpful.
-Steve
PapaLion — Tue Jul 08, 2008 12:50 pm
First, thanks much for the personal help, I am not too sharp on DB or MySQL yet. I would gladly share notes on my fumbling with others, edited by someone who has real knowledge.
I checked the server folks, No, we are not PHP Safe mode.
http://www.AlmostYuman.com/Yumanity is site/directory I wish to use for Xataface.
index.php
<?require_once ‘http://www.almostyuman.com/Yumanity/xataface-1.0-beta-3/dataface-public-api.php’‘;df_init(__FILE__, ‘http://AlmostYuman.com/Yumanity/Dataface’);$app =& Dataface_Application::getInstance();$app->display();?>
conf.ini
[_database]host = “http://www.AlmostYuman.com”user = “Xata”password = “AYXata1”name = “FacultyOfWidgetry”[_tables]Course = “Course”Program = “Program”
.htaccess
I did not install ALL of the DB items for the ex… only the first two items for each one Course and Program and i did check to see if it was installed/showed up etc… all seems aok?
thanks much hoping I can settle down, take my time, understand zactleee what I’m doing wrong here.
shannah — Tue Jul 08, 2008 1:14 pm
Thanks for posting the details of the install. This makes it clear what the problem is.
- The line
- Code: Select all
require_once 'http://www.almostyuman.com/Yumanity/xataface-1.0-beta-3/dataface-public-api.php'';
Has problems because you need to provide the path in the filesystem to the dataface-public-api.php file - not the URL. It should look something like:
- Code: Select all
require_once '/var/www/Yumanity/xataface-1.0-beta-3/dataface-public-api.php'';
But this is just an example… you need to make sure you provide the correct file system path.
- The line:
- Code: Select all
df_init(__FILE__, 'http://AlmostYuman.com/Yumanity/Dataface');
Is inconsistent with the first line. This should be the URL to your xataface directory. E.g. if the xataface folder is called xataface-1.0-beta-3, as your first line suggests, then this should be something like:
- Code: Select all
df_init(__FILE__, 'http://AlmostYuman.com/Yumanity/xataface-1.0-beta-3');
- For some reason carriage returns aren’t showing up in the forum. Hopefully this is just the way they ended up after pasting to the forum. If your actual files look this way then you need to add carriage returns in the appropriate places.
e.g.
- Code: Select all
[_database]host = "http://www.AlmostYuman.com"user = "Xata"password = "AYXata1"name = "FacultyOfWidgetry"[_tables]Course = "Course"Program = "Program"
should look like:
- Code: Select all
- `[_database]
host = “http://www.AlmostYuman.com”
user = “Xata”
password = “AYXata1”
name = “FacultyOfWidgetry”[_tables]
Course = “Course”
Program = “Program”`
This could be a line ending issue (the sample files use unix line endings). Best to use a text editor that can work with unix line endings (not notepad). Crimson Editor is a good one for windows (but there are lots out there….. I’m a mac user so I’m not all that up to date with the latest and greatest windows software).
Hope this helps.
Best regards
Steve
PapaLion — Tue Jul 08, 2008 3:15 pm
Goal: This is the page I am trying to get/direct my browser to, to eventually request/load? correct…which will be an example/FacultyOfWidgetry
http://almostyuman.com/Yumanity/Faculty … /index.php
I get Internal Server Error now.
In index.php I first create the path on the server line 1
/require_once ‘/path/to/dataface/dataface-public-api.php’;
which I have now as
require_once ‘/public_html/Yumanity/xataface-1.0-beta-3/dataface-public-api.php’;
line 2, I specify the URL
df_init(__FILE__, ‘http://yourdomain.com/dataface’);
which I have as
df_init(__FILE__, ‘http://AlmostYuman.com/Yumanity/xataface-1.0-beta-3/Dataface’);
This second step I am less confident with? “D”ataface is in my xataface 1.0-beta-3 directory… this is the same one as “d”ataface in the directions?
I redid my config.init with the returns etc to match the form. I found site_skeleton which also has these of course to copy. Handy.
hmmm still inop… as of the moment, I am re reading the steps and your hints more carefully yet again.
One note in RE reading your help was permissions… I set permissions as 755/write owner for Dataface/tempates_c.
shannah — Tue Jul 08, 2008 3:28 pm
I don’t see anything that should be causing an error. Must be some config thing in the server that we need to be aware of. Problem could be solved in seconds if you could get your hands on the error log.
Believe me. You’re going to want to know how to read your error log if you’re going to be doing any development, as this is just the beginning.
On other items:
-
The “dataface” directory is actually now the “xataface-1.0-beta-3” directory. Not be be confused with the “D”ataface subdirectory. This is a remnant of the recent name change of the framework.
-
templates_c should be set to 777 not 755, as the web server needs to write to it.
-Steve
PapaLion — Tue Jul 08, 2008 5:49 pm
[Tue Jul 8 18:03:53 2008] [error] [client 75.171.103.230] File does not exist: /home/almost8/public_html/500.shtml
[Tue Jul 8 18:03:53 2008] [alert] [client 75.171.103.230] /home/almost8/public_html/Yumanity/FacultyOfWidgetry/.htaccess: Missing </FilesMatch> directive at end-of-file
[Tue Jul 8 18:03:46 2008] [error] [client 75.171.103.230] File does not exist: /home/almost8/public_html/500.shtml
[Tue Jul 8 18:03:46 2008] [alert] [client 75.171.103.230] /home/almost8/public_html/Yumanity/FacultyOfWidgetry/.htaccess: Missing </FilesMatch> directive at end-of-file
[Tue Jul 8 18:03:20 2008] [error] [client 75.171.103.230] (2)No such file or directory: File does not exist: /home/almost8/public_html/Yumanity/index.php
[Tue Jul 8 18:03:10 2008] [error] [client 75.171.103.230] File does not exist: /home/almost8/public_html/500.shtml
[Tue Jul 8 18:03:10 2008] [alert] [client 75.171.103.230] /home/almost8/public_html/Yumanity/FacultyOfWidgetry/.htaccess: Missing </FilesMatch> directive at end-of-file
[Tue Jul 8 18:03:03 2008] [error] [client 75.171.103.230] File does not exist: /home/almost8/public_html/500.shtml
[Tue Jul 8 18:03:03 2008] [alert] [client 75.171.103.230] /home/almost8/public_html/Yumanity/FacultyOfWidgetry/.htaccess: Missing </FilesMatch> directive at end-of-file
[Tue Jul 8 18:03:01 2008] [alert] [client 75.171.103.230] /home/almost8/public_html/Yumanity/FacultyOfWidgetry/.htaccess: Missing </FilesMatch> directive at end-of-file
[Tue Jul 8 18:02:53 2008] [error] [client 75.171.103.230] (2)No such file or directory: File does not exist: /home/almost8/public_html/Yumanity/index.php
[Tue Jul 8 17:47:10 2008] [error] [client 75.171.103.230] File does not exist: /home/almost8/public_html/500.shtml
[Tue Jul 8 17:47:10 2008] [alert] [client 75.171.103.230] /home/almost8/public_html/Yumanity/FacultyOfWidgetry/.htaccess: Missing </FilesMatch> directive at end-of-file
[Tue Jul 8 17:47:08 2008] [alert] [client 75.171.103.230] /home/almost8/public_html/Yumanity/FacultyOfWidgetry/.htaccess: Missing </FilesMatch> directive at end-of-file
[Tue Jul 8 17:46:59 2008] [error] [client 75.171.103.230] (2)No such file or directory: File does not exist: /home/almost8/public_html/Yumanity/index.php
There is probably more from earlier… but this is the last attempt. I/that would be / ME! needed to go look on cpanel and FIND the error logs, they’re there. Alos I changed the permissions only on template_c to 777. hmmm still stubbornly refuses to let me have any fun:)
PapaLion — Tue Jul 08, 2008 5:57 pm
I just “fixed” the .htaccess file so it looks correct and it changed! eureka movement… the URL page gave up this
Warning: require_once(/public_html/Yumanity/xataface-1.0-beta-3/dataface-public-api.php) [function.require-once]: failed to open stream: No such file or directory in /home/almost8/public_html/Yumanity/FacultyOfWidgetry/index.php on line 2
Fatal error: require_once() [function.require]: Failed opening required ‘/public_html/Yumanity/xataface-1.0-beta-3/dataface-public-api.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/almost8/public_html/Yumanity/FacultyOfWidgetry/index.php on line 2
hmm… which is zactlee what?
sorry for two posts in a row, thanks for staying with it. I appreciate the direction.
shannah — Tue Jul 08, 2008 10:33 pm
OK. You’re almost there. This error is telling you that you have the wrong path for your xataface directory in the require_once statement.
You can give yourself a hint of the correct path by having the script print out the path to itself, and then extrapolate that path to figure out the correct path to the xataface directory.
Add the following to the beginning of your index.php file (after the opening <?php)
- Code: Select all
echo dirname(__FILE__);
That will print the path to the current directory. Use this path as a clue so you can figure out the path to the xataface directory.
(note that you can also use relative paths. E.g. if the xataface directory is located at the same level as the application directory, you could do something like:
- Code: Select all
require_once '../xataface-1.0-beta-3/dataface-public-api.php';
Best regards
Steve
PapaLion — Wed Jul 09, 2008 4:20 pm
Update, the second code line was helpful, the error msgs changed to a focus on the MySql DB, a host ID error … point is it moved probably because finally we got line 2 of the index.php pretty close to right. I never did figure out the exact path for sure? Also an unusual FTP uploaded file popped up in the directory, which spooked me (sniffing or such maybe) so I decided to remove the directory and Faculty Db for now. I will focus on learning more about my client activity on a shared server (Built my own LAMP but had poor security all by myself). Then I will learn a bit more about how to better understand/write pathways on shared servers. Finally I will decide zactlee where the Xataface needs to be on my root and attempt another manual install with no command line (as a long time linux learner I like command line/3, I will miss it), costs more for a VdedicatedServer than I want to go today. If I can get it running then I will share notes which should be edited by experienced developers and may be useful to someone and I will welcome a little more help if available.
One ? »> Is it very important to focus on the FacultyOfWidgetry example… MUST I? Somehow I think I’d like to try a very simple DB and try to get a sorta kickstart (a very tech term).
much thanks for the generous help.
shannah — Tue Jul 08, 2008 3:28 pm
I don’t see anything that should be causing an error. Must be some config thing in the server that we need to be aware of. Problem could be solved in seconds if you could get your hands on the error log.
Believe me. You’re going to want to know how to read your error log if you’re going to be doing any development, as this is just the beginning.
On other items:
-
The “dataface” directory is actually now the “xataface-1.0-beta-3” directory. Not be be confused with the “D”ataface subdirectory. This is a remnant of the recent name change of the framework.
-
templates_c should be set to 777 not 755, as the web server needs to write to it.
-Steve
PapaLion — Tue Jul 08, 2008 5:49 pm
[Tue Jul 8 18:03:53 2008] [error] [client 75.171.103.230] File does not exist: /home/almost8/public_html/500.shtml
[Tue Jul 8 18:03:53 2008] [alert] [client 75.171.103.230] /home/almost8/public_html/Yumanity/FacultyOfWidgetry/.htaccess: Missing </FilesMatch> directive at end-of-file
[Tue Jul 8 18:03:46 2008] [error] [client 75.171.103.230] File does not exist: /home/almost8/public_html/500.shtml
[Tue Jul 8 18:03:46 2008] [alert] [client 75.171.103.230] /home/almost8/public_html/Yumanity/FacultyOfWidgetry/.htaccess: Missing </FilesMatch> directive at end-of-file
[Tue Jul 8 18:03:20 2008] [error] [client 75.171.103.230] (2)No such file or directory: File does not exist: /home/almost8/public_html/Yumanity/index.php
[Tue Jul 8 18:03:10 2008] [error] [client 75.171.103.230] File does not exist: /home/almost8/public_html/500.shtml
[Tue Jul 8 18:03:10 2008] [alert] [client 75.171.103.230] /home/almost8/public_html/Yumanity/FacultyOfWidgetry/.htaccess: Missing </FilesMatch> directive at end-of-file
[Tue Jul 8 18:03:03 2008] [error] [client 75.171.103.230] File does not exist: /home/almost8/public_html/500.shtml
[Tue Jul 8 18:03:03 2008] [alert] [client 75.171.103.230] /home/almost8/public_html/Yumanity/FacultyOfWidgetry/.htaccess: Missing </FilesMatch> directive at end-of-file
[Tue Jul 8 18:03:01 2008] [alert] [client 75.171.103.230] /home/almost8/public_html/Yumanity/FacultyOfWidgetry/.htaccess: Missing </FilesMatch> directive at end-of-file
[Tue Jul 8 18:02:53 2008] [error] [client 75.171.103.230] (2)No such file or directory: File does not exist: /home/almost8/public_html/Yumanity/index.php
[Tue Jul 8 17:47:10 2008] [error] [client 75.171.103.230] File does not exist: /home/almost8/public_html/500.shtml
[Tue Jul 8 17:47:10 2008] [alert] [client 75.171.103.230] /home/almost8/public_html/Yumanity/FacultyOfWidgetry/.htaccess: Missing </FilesMatch> directive at end-of-file
[Tue Jul 8 17:47:08 2008] [alert] [client 75.171.103.230] /home/almost8/public_html/Yumanity/FacultyOfWidgetry/.htaccess: Missing </FilesMatch> directive at end-of-file
[Tue Jul 8 17:46:59 2008] [error] [client 75.171.103.230] (2)No such file or directory: File does not exist: /home/almost8/public_html/Yumanity/index.php
There is probably more from earlier… but this is the last attempt. I/that would be / ME! needed to go look on cpanel and FIND the error logs, they’re there. Alos I changed the permissions only on template_c to 777. hmmm still stubbornly refuses to let me have any fun:)
PapaLion — Tue Jul 08, 2008 5:57 pm
I just “fixed” the .htaccess file so it looks correct and it changed! eureka movement… the URL page gave up this
Warning: require_once(/public_html/Yumanity/xataface-1.0-beta-3/dataface-public-api.php) [function.require-once]: failed to open stream: No such file or directory in /home/almost8/public_html/Yumanity/FacultyOfWidgetry/index.php on line 2
Fatal error: require_once() [function.require]: Failed opening required ‘/public_html/Yumanity/xataface-1.0-beta-3/dataface-public-api.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/almost8/public_html/Yumanity/FacultyOfWidgetry/index.php on line 2
hmm… which is zactlee what?
sorry for two posts in a row, thanks for staying with it. I appreciate the direction.
shannah — Tue Jul 08, 2008 10:33 pm
OK. You’re almost there. This error is telling you that you have the wrong path for your xataface directory in the require_once statement.
You can give yourself a hint of the correct path by having the script print out the path to itself, and then extrapolate that path to figure out the correct path to the xataface directory.
Add the following to the beginning of your index.php file (after the opening <?php)
- Code: Select all
echo dirname(__FILE__);
That will print the path to the current directory. Use this path as a clue so you can figure out the path to the xataface directory.
(note that you can also use relative paths. E.g. if the xataface directory is located at the same level as the application directory, you could do something like:
- Code: Select all
require_once '../xataface-1.0-beta-3/dataface-public-api.php';
Best regards
Steve
PapaLion — Wed Jul 09, 2008 4:20 pm
Update, the second code line was helpful, the error msgs changed to a focus on the MySql DB, a host ID error … point is it moved probably because finally we got line 2 of the index.php pretty close to right. I never did figure out the exact path for sure? Also an unusual FTP uploaded file popped up in the directory, which spooked me (sniffing or such maybe) so I decided to remove the directory and Faculty Db for now. I will focus on learning more about my client activity on a shared server (Built my own LAMP but had poor security all by myself). Then I will learn a bit more about how to better understand/write pathways on shared servers. Finally I will decide zactlee where the Xataface needs to be on my root and attempt another manual install with no command line (as a long time linux learner I like command line/3, I will miss it), costs more for a VdedicatedServer than I want to go today. If I can get it running then I will share notes which should be edited by experienced developers and may be useful to someone and I will welcome a little more help if available.
One ? »> Is it very important to focus on the FacultyOfWidgetry example… MUST I? Somehow I think I’d like to try a very simple DB and try to get a sorta kickstart (a very tech term).
much thanks for the generous help.
shannah — Wed Jul 09, 2008 6:07 pm
A lot to comment on there. One thing to keep in mind is that you don’t need a dedicated server to get command line access. Most good web hosts provide command line access (so you would be able to run the auto install). I steer clear of the FTP only hosts because they really limit productivity.
There are plenty of hosting options to choose from, but one such is
which can provide you with full command line access (a virtual private server) for $10/mo or even less.
That said, Xataface should work fine on an FTP only host. If you’re now getting a db error, that likely means that your db connection information in the conf.ini file is incorrect.
One thing that occurs to me that may be helpful for you is to use the web based xataface installation tool. This is new in the latest version and still experimental so there is no documentation on the site for it. However you can access this tool at
http://yourdomain.com/path/to/xataface/installer.php
You will need to use your database username and password to access the tool.
Essentially this tool will generate the files for you with the correct paths for you to download as a tar.gz archive. You can then upload these files anywhere on your server to get you started.
-STeve
PapaLion — Fri Jul 11, 2008 8:09 am
installer yields a line 211 error as found in other forums reuqiring mods on some internal files.
I cannot wrap my mind around where exactly my folder fo revised site_structure files go so it reaches and runs the api file? If I place them /mysite/directory/A to reach this dataface-public-api file. Then… directing the path to >api file & attempted opening result in an error msg that I have not described the path correctly on line 12, also generates a second error, > fatal error for line 14, i.e. cannot open the line 12 instructions, so the program cannot find line 14. The api is in folder A the line 14 file is in folder B /mysite/directory/B.
I have tried stacking them, B inside of A, parallel placement, A on same level as B, higher directory for each, B on root/B etc and redirecting on line 12…I tried moving this api file inside the folder for my site_structure files, mysite/.directory/B/api… nah that is worse. ad nauseum… my conclusion might just be ya can’t get there from here. I am on the wrong freeway.
PapaLion — Fri Jul 11, 2008 8:24 am
better probably to just show the error msgs…
test is Folder B
AYDbase is folder A
Warning: require_once(/Yumanity/test/dataface-public-api.php) [function.require-once]: failed to open stream: No such file or directory in /home/almost8/public_html/Yumanity/AYDbase/index.php on line 12
yet there is a path from / to index.php inside my revised site_structure folder, AYDbase.
Fatal error: require_once() [function.require]: Failed opening required ‘/Yumanity/test/dataface-public-api.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/almost8/public_html/Yumanity/AYDbase/index.php on line 12
meanwhile ~test~ folder B contains api file which cannot sit inside the AYDbase folder A and inside test folder B at the same time?
PapaLion — Fri Jul 11, 2008 10:13 am
sorry 2 keep posting, a small breakthru via the installer… it decided to allow a make of the three site files inside a new directory it built called almost8_XataDbase1… a variant of B unique to shared servers I expect adding a preID_to the Dbase name. sheesh!
Ok, I think? that is very good:) the conf.ini file is probably not correct yet, it will not yield the index.php when I point to the URL… simple 404 error.
so? my ??? would be here»> choices for host Id become important next?
a. “localhost” no
b. “almostyuman.com” with or without some hashes to get it there?
c. host could be the site itself http://www.mysite.com
d. ? dunno?
happily it has the correct Dbase ID
user name/pw gets hairy because of ads via shared server I’ll have to try a few.
shannah — Fri Jul 11, 2008 10:45 am
Wow. This is painful to watch from this vantage point. First I shall attack the
Warning: require_once(/Yumanity/test/dataface-public-api.php) [function.require-once]: failed to open stream: No such file or directory in
errors.
This error means that you have the wrong path (i.e. the file /Yumanity/test/dataface-public-api.php does not exist). Indeed this path looks unlikely to exist because your Yumanity folder likely resides inside a parent folder like /home/xyz/.. etc..
If you want to find the definitive path, you can log in via command line FTP and issue the command ‘pwd’.
Here is a small readout of me logging into an FTP server and findout out the path to my home directory:
- Code: Select all
stevepbook:~ shannah$ ftp css.css.sfu.ca Connected to css.css.sfu.ca. 220 css FTP server (SunOS 5.8) ready. Name (css.css.sfu.ca:shannah): shannah 331 Password required for shannah. Password: 230 User shannah logged in. Remote system type is UNIX. Using binary mode to transfer files. ftp> pwd Remote directory: /home/fas/shannah ftp>
Trying random permutations of paths will get you frustrated and likely result in no success.
Setting up Xataface is trivial if you have a grasp of
a. The directory structure of your server.
b. Your server’s MySQL Login details.
I suggest trying a couple of exercises first to get you familiar with these things.
Exercise 1: Include one PHP file in another.
Steps:
Create a directory somewhere on your server called ‘helloworld’.
Create a file within helloworld called ‘hello.php’ with the contents.
- Code: Select all
<?php echo 'Hello world';
Create another directory somewhere else on your server called ‘hellopages’.
Create a file within hellopages called index.php with the following contents:
- Code: Select all
<?php require_once '/path/to/helloworld/hello.php';
Where ‘/path/to/helloworld’ is the absolute path to your helloworld folder on your server.
Then point your web browser to http://yourdomain.com/path/to/hellopages/index.php
(i.e. the URL to your hellopages page).
Note that the /path/to/hellopages path in this url is relative to your document root, whereas the ‘/path/to/helloworld’ from the index.php file is an absolute path from the root of your file system.
If everything works then you should see “hello world”. Otherwise you’ll get an error.
If you get an error, that means you have the path wrong in your index.php file. One tool you can use to find the correct path is to call the phpinfo() function in your PHP file and then load the page. This will show you all of the environment information.
e.g. Create a file named phpinfo.php with the contents:
- Code: Select all
<?php phpinfo();
Then load the page in your web browser. The Document Root setting will show you the path to your web server’s document root. Likely all other files you have placed on your server are relative to this value.
Do not proceed until you can get this exercise working because any attempts to get any other scripts working will be futile unless you can master this exercise.
Exercise 2: Database connection
In this exercise you will create a database on your web server and try to connect to it.
Steps:
- Create a new database using whatever database tools your host provides, named ‘helloworld’.
- Create a file on your web server called ‘hellodb.php’ with the following contents:
- Code: Select all
- `<?php
$db = mysql_connect(‘HOST’, ‘USERNAME’, ‘PASSWORD’);
if ( !$db ) die(“Failed to connect to database: “.mysql_error());$res = mysql_select_db(‘helloworld’, $db);
if ( !$res ) die(“Failed to select database: “.mysql_error());echo “Connected successfully!”;`
But replace ‘HOST’ with the host name of your database (usually ‘localhost’, but may be different - check instructions from your web host for the proper host name); And replace USERNAME and PASSWORD with the username and password that you have been supplied with to connect to the MySQL server (it should say this somewhere in your web host information).
Step 2: Point your web browser to this page (hellodb.php). If you receive an error, note the error and try to make changes accordingly until you see the text “Connected successfully” on the screen.
Once you have successfully completed these two exercises you are ready to proceed to creating a xataface application. If you cannot master these two exercises then attempts to create a xataface application will be futile.
Best regards
Steve
PapaLion — Fri Jul 11, 2008 6:28 pm
sheesh, homework for the weekend… well, since I am getting very low D in Xataface tweaking/install this week it is very appropriate… I will do the exercises till they work well for me and clear my fog… I do appreciate the help and I will persist till it flies nicely.
enjoy,
Bret
PapaLion — Fri Jul 11, 2008 6:28 pm
sheesh, homework for the weekend… well, since I am getting very low D in Xataface tweaking/install this week it is very appropriate… I will do the exercises till they work well for me and clear my fog… I do appreciate the help and I will persist till it flies nicely.
enjoy,
Bret