Why Am I Having This Problem. - Webmasters - Nairaland
Nairaland Forum › Science/Technology › Webmasters › Why Am I Having This Problem. (1060 Views)
| Why Am I Having This Problem. by sunday478(op): 10:43pm On Dec 15, 2013 |
Hello, webmasters, I was trying to file reading function to work but it keeps backfiring saying 'warning: file(the directoryandfilename)[function.file]:failed to open stream. Bla bla, am running on a local host (ampps), I don't no where the error is coming from, can someone pls help |
| Re: Why Am I Having This Problem. by Nobody: 10:45pm On Dec 15, 2013 |
No such file or directory? Check the path correctly. |
| Re: Why Am I Having This Problem. by cbrass(m): 11:12pm On Dec 15, 2013 |
Check you include() or require() it maybe you wrote a wrong file path Or the file doesn't exist on your local machine |
| Re: Why Am I Having This Problem. by sunday478(op): 11:54pm On Dec 15, 2013 |
The file exist, the one for reading from file does not work. The one for writing does not work also, could it be the ampps |
| Re: Why Am I Having This Problem. by cbrass(m): 12:08am On Dec 16, 2013 |
sunday478: The file exist, the one for reading from file does not work. The one for writing does not work also, could it be the amppsI don't get you at all, can you post your code and let us look through it ![]() |
| Re: Why Am I Having This Problem. by onyengbu: 7:21pm On Dec 16, 2013 |
cbrass: I don't get you at all, can you post your code and let us look through iti thought i was alone there... ol boy explain youeself better. |
| Re: Why Am I Having This Problem. by yawatide(f): 7:55pm On Dec 16, 2013 |
Maybe you don't have the right permissions on the server side? |
| Re: Why Am I Having This Problem. by cbrass(m): 11:57pm On Dec 16, 2013 |
The guy looks and smells like a newbie... |
| Re: Why Am I Having This Problem. by sunday478(op): 8:57am On Dec 17, 2013 |
yawa-ti-de:ok, how do I grant the permision. The Fwrite function doesn't work, like wise that of read. The whole code are correct, they were simple and staright forward. |
| Re: Why Am I Having This Problem. by sunday478(op): 8:58am On Dec 17, 2013 |
cbrass: The guy looks and smells like a newbie...yes, a newbie. |
| Re: Why Am I Having This Problem. by onyengbu: 9:05am On Dec 17, 2013 |
cbrass: The guy looks and smells like a newbie...How is that a crime? What if I say you sound and appear rude.... will you like that? ![]() |
| Re: Why Am I Having This Problem. by cbrass(m): 6:26pm On Dec 17, 2013 |
onye_ngbu*:I don't mean that noww...we once newbies too |
| Re: Why Am I Having This Problem. by cbrass(m): 6:30pm On Dec 17, 2013 |
sunday478: yes, a newbie.Ok let me try to ask this way: what event triggers that error?? I mean like what and what do you do on the website before that error comes up |
| Re: Why Am I Having This Problem. by Lipso: 12:42am On Dec 18, 2013 |
Dear Nairaland webmasters, I need all the help to make this site standard and look professional. www.westlifeelectronicssuccess. Please,assist me with the necessary hints/steps to take to make it up to standard.Am a newbie to all these internet stuff.Thanks to you all. |
| Re: Why Am I Having This Problem. by hilaryiwens05: 12:46am On Dec 18, 2013 |
Guy wat is wrong wit u...get ur own thread and stop spammin people thread Lipso: Dear Nairaland webmasters, I need all the help to make this site standard and look professional. |
| Re: Why Am I Having This Problem. by yawatide(f): 9:34pm On Dec 18, 2013 |
Right-click the affected folder and file(s), in cpanel, and click "change permissions". Report back with the 3-digit number(s) that you get returned to you. |
| Re: Why Am I Having This Problem. by DualCore1: 9:44pm On Dec 18, 2013 |
Post your code on pastebin.com and share the URL here. (Subsequently I will be saying "pastebin your code" );yawa-ti-de:He's trying this from his local webserver, according to him. |
| Re: Why Am I Having This Problem. by greatdeveloper(m): 10:57pm On Dec 18, 2013 |
If you are answering him you answer him straight and not insulting him first, if you don't know don't answer at all. FORCE was not placed on the subject |
| Re: Why Am I Having This Problem. by IamGodzilla: 4:10am On Dec 19, 2013 |
Ok, make sure you know the file path.. E.g if you have a folder called path and a file called folder.txt. And a script called script.php in your root You have to find a way to link to the path folder like this in your script.php $path = fopen("path/folder.txt", "r" or exit("unable to open file" ; |
| Re: Why Am I Having This Problem. by sunday478(op): 5:17am On Dec 19, 2013 |
Dual Core: Post your code on pastebin.com and share the URL here. (Subsequently I will be saying "pastebin your code"this is the code. http://pastebin.com/BZX7gXf1 |
| Re: Why Am I Having This Problem. by sunday478(op): 5:21am On Dec 19, 2013 |
This is the code. <!doctype html> <html> <head> <meta charset="utf-8"> <title>Reading From File</title> </head> <?php $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT']; $filename = $DOCUMENT_ROOT.'learning php/css/'.'basic_2.txt'; $line_in_file = count(file($filename)); $fp = fopen($filename, 'r'); //this opens the file for reading for ($ii = 1; $ii <= $line_in_file; $ii++) { $line = fgets($fp); //reads one line from the file $city = trim($line); } fclose($fp); ?> </html> |
| Re: Why Am I Having This Problem. by IamGodzilla: 6:55am On Dec 19, 2013 |
sunday478: This is the code.You omitted a '/' after the $DOCUMENT_ROOT.'Learning'..... That could be the problem Use $DOCUMENT_ROOT.'/learning'..... If that doesn't still work. Try back linking manually like this '../path/to/folder where/basic2.txt' The ../ means go back once to where the file is ../../ means go back twice to where file is Or if script is in same folder as d file. Just use 'learning/php/css/basic2.text' Hope this helps |
| Re: Why Am I Having This Problem. by cbrass(m): 8:30am On Dec 19, 2013 |
Ok why not do it this way $filename = "basic.txt"; then makesure the basic.txt file is on ur wampserver or mampserver or lampserver. I mean look for the folder named "www" and makesure its there |
| Re: Why Am I Having This Problem. by sunday478(op): 9:42am On Dec 19, 2013 |
cbrass: Ok why not do it this way $filename = "basic.txt"; then makesure the basic.txt file is on ur wampserver or mampserver or lampserver. I mean look for the folder named "www" and makesure its thereyes, the file is in the www folder. That is why am so worried |
| Re: Why Am I Having This Problem. by cbrass(m): 3:03pm On Dec 19, 2013 |
sunday478: yes, the file is in the www folder. That is why am so worriedOk remove that $DOCUMENT ROOT Then remove that COUNT() and File() , just leave it at $filename="basic1.txt"; if it gives an error copy the error and paste it here so we can see |
| Re: Why Am I Having This Problem. by sunday478(op): 7:06pm On Dec 19, 2013 |
Ok |
Is This Problem From My Firefox Or Google? (pic Attached) • Registeram.com.ng Is Fraud. Is Anyone Experiencing This Problem • Web4africa: Reseller Host, Who Else Is Having This Issues? • 2 • 3 • 4
Please Is They Any Wapka Wapmaster's In The House. • Blog/website For Sale • White Label SMS Complete Solution | Your Opinion Needed | Work In Progress . . .


);