icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » path to a subdomain

PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >>

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old November 7th, 2005, 10:11 PM   #1 (permalink)
Registered User
Fresh Surpasser
 
Joined in Nov 2005
4 posts
Gave thanks: 0
Thanked 0 times
path to a subdomain

I have a script running on a subdomain and need to know the exact path to the script.

The script calls for me to enter the information noted here:

Quote:
define ("REPORT_FILE_URL", "http://www.mountainexpress.margaritaair.com/logs/"); // URL where the complete FSAcars reports will be stored
define ("REPORT_FILE_PATH", "/home/margari/public_html/mountainexpress/logs/"); // Folder where the complete FSAcars reports will be stored
define ("ERROR_LOG_PATH", "/home/margari/public_html/logs/error.log"); // Folder and filename where the error log is located
But the program I am running cannot find the log file - getting the following error:

Quote:
Warning: fopen(/home/margari_public_html/logs/error.log): failed to open stream: No such file or directory in /home/margari/public_html/mountainexpress/php/receive_pirep.php on line 82

Warning: fwrite(): supplied argument is not a valid stream resource in /home/margari/public_html/mountainexpress/php/receive_pirep.php on line 83

Warning: fclose(): supplied argument is not a valid stream resource in /home/margari/public_html/mountainexpress/php/receive_pirep.php on line 84
OK
Am I writing the path to this subdomain correctly?
maceo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 7th, 2005, 10:26 PM   #2 (permalink)
is scientific.
Resident.
 
David's Avatar
 
Joined in Mar 2004
Lives in fear of Obama.
Hosted on Pass 7
13,117 posts
Gave thanks: 8
Thanked 34 times
You should be able to run it by just having the path set as the folder it's in, rather than using the subdomain. So http://www.something.com/folder rather than http://subdomain.something.com
__________________
Quote:
Originally Posted by removed View Post
Internet Explorer rules.
David is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 7th, 2005, 10:31 PM   #3 (permalink)
Registered User
Fresh Surpasser
 
Joined in Nov 2005
4 posts
Gave thanks: 0
Thanked 0 times
Thanks - will try it.
maceo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 8th, 2005, 2:53 PM   #4 (permalink)
Registered User
Fresh Surpasser
 
Joined in Nov 2005
4 posts
Gave thanks: 0
Thanked 0 times
I tried moving everything out of the subdomain and still not working.

I pulled up the PHP Manual for the fopen command, and it states the following in regards to the mode character

Quote:
Note: Different operating system families have different line-ending conventions. When you write a text file and want to insert a line break, you need to use the correct line-ending character(s) for your operating system. Unix based systems use \n as the line ending character, Windows based systems use \r\n as the line ending characters and Macintosh based systems use \r as the line ending character.

If you use the wrong line ending characters when writing your files, you might find that other applications that open those files will "look funny".

Windows offers a text-mode translation flag ('t') which will transparently translate \n to \r\n when working with the file. In contrast, you can also use 'b' to force binary mode, which will not translate your data. To use these flags, specify either 'b' or 't' as the last character of the mode parameter.

The default translation mode depends on the SAPI and version of PHP that you are using, so you are encouraged to always specify the appropriate flag for portability reasons. You should use the 't' mode if you are working with plain-text files and you use \n to delimit your line endings in your script, but expect your files to be readable with applications such as notepad. You should use the 'b' in all other cases.

If you do not specify the 'b' flag when working with binary files, you may experience strange problems with your data, including broken image files and strange problems with \r\n characters.

Note: For portability, it is strongly recommended that you always use the 'b' flag when opening files with fopen().
On line 82 of the code, there is an fopen command

Would changing the fopen (ERROR_LOG_PATH, "a"); to some other ending character have any effect on the Surpass server?
maceo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 13th, 2005, 8:18 PM   #5 (permalink)
All Ur Base R Belong 2 Us
Excelling Contributor
 
mr_fern's Avatar
 
Joined in Feb 2005
Lives in Vegas & New York
824 posts
Gave thanks: 2
Thanked 6 times
The first warning shows you what's really going wrong....

Warning: fopen(/home/margari_public_html/logs/error.log): failed to open stream: No such file or directory

Instead of it trying to open /home/margari/public_html/logs/error.log, it's trying to open /home/margari_public_html/logs/error.log

Although from the first quote, it appears you defined the path to the file correctly. Check out line 82 of the "receive_pirep.php" file and make sure it is opening the defined ERROR_LOG_PATH, instead of some variable which might have stored an altered version of the path.
__________________
Nobody doing nothing
mr_fern is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 13th, 2005, 11:51 PM   #6 (permalink)
is scientific.
Resident.
 
David's Avatar
 
Joined in Mar 2004
Lives in fear of Obama.
Hosted on Pass 7
13,117 posts
Gave thanks: 8
Thanked 34 times
PHP-Man to the rescue!
__________________
Quote:
Originally Posted by removed View Post
Internet Explorer rules.
David is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 13th, 2005, 11:58 PM   #7 (permalink)
Marketing Maven
Surpass Staff
 
Kayla's Avatar
 
Joined in May 2003
Lives in Orlando
24,749 posts
Gave thanks: 946
Thanked 806 times
Definitely.
Kayla is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 14th, 2005, 6:20 PM   #8 (permalink)
Registered User
Fresh Surpasser
 
Joined in Nov 2005
4 posts
Gave thanks: 0
Thanked 0 times
I did resolve it by changing the line to:


(ERROR_LOG_PATH, "ab"); - that did the trick


I also noted the typo in the path and had corrected that already - this final change seemed to make the differerence.

Thanks
Todd
maceo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On