
angelleye
Members-
Posts
44 -
Joined
-
Last visited
Never
Everything posted by angelleye
-
Rookie question regarding include files with PHP..???
angelleye replied to angelleye's topic in PHP Coding Help
Seems to be working on the servers I'm playing with now. I don't know why I thought it seemed to take me to the actual document root instead of the site root in the past. I guess I'm good for now. Thanks! -
Rookie question regarding include files with PHP..???
angelleye replied to angelleye's topic in PHP Coding Help
Ok, that makes sense. Can you provide any tip on how to get PHP to always refer to the site root no matter what server it's running from? -
I'm a little confused with the use of absolute paths in PHP. I've always used relative paths but it's becoming an issue with some of the apps I'm working with and absolute would solve the problem. The thing is, I'm getting different results in different places and I'm a little confused. With regular HTML I seem to be able to use / as the root of my site. So if I do the following... <img src="/images/name.jpg" /> That works fine no matter what page it's called from in the site and no matter what directory that page is in. I need to be able to do that same thing with PHP. Now, in my custom 404 page I have the following... if($AddressURL == 'http://www.domain.com/blog/files/filename.zip') { header('HTTP/1.1 301 Moved Permanently'); header('Location: /download/filename.zip'); exit(); } That actually works just fine. If I go to the /blog/files/filename.zip (which doesn't exist) in a web browser it winds up downloading the file at www.domain.com/download/filename.zip as expected. Now where I get confused is that include files don't seem to work like that with PHP. If I do this... require_once('/includes/config.php'); That winds up looking for an /includes folder all the way back at the local server root, not just the web root. so it's looking for /var/includes instead of /var/www/includes and of course that doesn't end up working. So, how come the include file paths work differently than regular HTML paths or header redirects in PHP? Is there any simple way I can always refer to the SITE root no matter what server it's running from? I've tried playing with $_SERVER['DOCUMENT_ROOT'] but it only seems to return the root of the current document, not the root of the whole site. So if I use it within a php file located in /var/www/includes/test.php it considers /includes the root which is not what I want. Any information would be greatly appreciated. Thanks!
-
Updating your database is not recommend on your return page. There is no guarantee the user will return to the return page (even with auto-return enabled). You should use IPN https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro instead, which is always guaranteed to take place. It's server to server communication, though, so it's a little bit tougher to setup. I created a solution that a lot of people are using. It's posted on PayPal's developer forum: https://www.x.com/thread/30664
-
This should be real simple I just don't know how to do it. I'm using PayPal IPN to process order data. IPN is setup to automatically re-try the IPN if doesn't receive a 200 OK response back from the IPN script. In my solution, though, I'm actually storing any MySQL errors and notifying the site owner so the script actually does successfully complete and send a 200 OK back to PayPal, therefore, the IPN is not re-tried. I'd like to send a 500 (or anything other than 200) back to PayPal when this happens, but of course, the script still needs to run successfully. Is there a way I can use header() or anything to force a specific response code back? This way if it's simply a matter of MySQL timing out (which tends to happen on shared servers sometimes) PayPal's system will re-try and I won't have to enter it myself. Any information on this would be greatly appreciated. Thanks!
-
You can specify a return_url in your html button code (as well as API requests) that will override anything you have set in your account profile. This way you can send dynamic return URL's with each payment instead of setting up a static URL in your profile. When using PayPal Standard, though, there is no guarantee the user will end up back at your site even with auto-return turned on. They could close the browser before the return happens. If you need to rely on this for updating a database, sending out email receipts, etc. you should use IPN and notify_url instead.
-
Yes, the host header is needed because I'm hosting more than 1 site on the same IP address and the same port. That part is all working fine. I've figured out that when I comment out the doc_root in php.ini then PHP pages will indeed load on the sites, however, all of my relative links to includes like css, js, etc. aren't working when I do that. Apparently what I need is to specify separate php.ini files for each site, or specify multiple doc_root's in a single php.ini file. Possible..??
-
I've got a test server setup at sandbox.mydomain.com on Win2k3 with IIS 6. I've got PHP installed on this server and it works great on the default web site in IIS. I've always had my client web sites under /client-sites on my default web site. The problem with this is that when my clients are using things like ./ in their links it goes back up to my actual root instead of their site's root (ie. sandbox.mydomain.com/client-sites/site-name). To fix this I've gone ahead and created additional A records in my DNS to point other sub-domains to my test server (ie. client.mydomain.com) and then I created a new site in IIS and applied the host header value of client.mydomain.com. With that I can successfully browse the client's site via http://client.mydomain.com, however, PHP does not work on these additional sites. It still works great on my default site in IIS, just not on any of the extra sites I add this way. I can browse HTML files, txt files, images, etc. just fine but anything PHP just gives me page not found. Any information on how I can make PHP work with ALL sites in IIS instead of just the default would be greatly appreciated. Thanks!
-
I've installed PHP on Win2k3 a number of times and I've never had a problem. This particular server is driving me nuts. I cannot figure out why PHP won't work on this IIS install. Here's what I've done. 1) Download the ZIP package of PHP for manual installation 2) Extract the files to C:\PHP 3) Edit php.ini in the following ways... - include_path = ".;c:\php\includes" - doc_root = "W:\" - extension_dir = "C:\PHP\ext" -cgi.force_redirect = 0 4) Added PHP to the Web Service Extensions in IIS and set it to the php5isapi.dll file. 5) Added C:\PHP to the Path variable under the system's Enviornment Variables and I also added a new variable called PHPRC with C:\PHP\php.ini 6) Reboot the server This usually takes care of everything and I can move on to MySQL install and then start putting my apps up. Not in this case. I'm getting 404 error any time I try and browse a PHP file on this web server. If I simply change that file to .txt instead of .php then it loads fine. Switch it back to .php and I get a 404 again. I've followed all of the steps here to try and troubleshoot (http://www.verysimple.com/blog/2008/01/05/php-on-windows-2003-iis-6-displays-404-page-not-found/) and nothing is working. I also tried running the file (which has nothing but echo 'test'; in it right now) from a command line and that is working just fine, so PHP itself is indeed functioning on the server. It's just that it's not communicating with IIS for some reason. I double checked that I added my Web Service Extension and it's in there as PHP with php5isapi.dll and it's set to Allowed. I've also compared this to my own working test server here and the only difference I can see is that they have MS SharePoint and FrontPage extensions installed and I've never had that in the mix. It's created an additional web site and an additional application pool apart from the defaults. I have no idea if that's causing any of my problems but it's the only thing different I see from all of the servers I've done this on in the past. Any information on how I can fix this would be greatly appreciated. Thanks!