![]() |
Too many php includes on one server, is it possible?
I have a project I am working on, and a big part of the project is to have this
<a href='<?php include('http://www.domain.com/urlinc/file.php'); ?>'> everywhere there are thousands of them is this putting an extra load on my server? what is wrong with doing it this way? |
The only thing to keep in mind is it's an extra disk hit (hit to the page, and a hit to the include from the page that's calling it).
I use them all over the place on my sites and have yet to become spindle bound. The pro to using them is it's easy to centralize things (such as headers or metas) so that you can make a global change by editing one file. Personally, I highly recommend includes when appropriate, and it appears to me that your use is more than appropriate. The alternative would be to have thousands of individual files that contain the same thing your include has. Hope that helps. |
Is the urlinc/file.php file actually remote? I've met many webmasters who actually do this when the file/domain exists on the same machine.
If the file is actually remote, It would probably be better practice to configure a cron job to retrieve an updated version of the file every hour, and include the file locally. If the file isn't remote, you should not be charging money for your services. |
if you use:
include('http://www.domain.com/urlinc/file.php'); it will slow it down quite a bit, if possible I would use only local includes like: include('urlinc/file.php'); |
Quote:
|
Quote:
|
my main issue has just started tonight
it gives me some wierd error I have never seen before Warning: php_network_getaddresses: getaddrinfo failed: name or service is not known in....then it gives the file name and the line # I restart apache and everything works great again |
Quote:
The way you have it now opens a HTTP connection which is very inefficient (plus it will fill up your web logs) |
Quote:
|
Quote:
I am running a whm/cpanel server, is this possible? to pull from another account? |
btw, I have to say, gfy may be idiotic at time, but there are some really knowledgeable people around here, and I thank you all big time for it :)
gfy has saved me from major issues so many times it isn't funny! haha |
Quote:
This will definitely speed your script up though. |
Quote:
the issue has started tonight Quote:
|
Quote:
Quote:
|
I use dreamweaver
|
Quote:
|
Quote:
|
Quote:
|
Quote:
I am setting up /usr/home/domain1/index.php and it calls the php from /usr/home/domain2/links.php |
Quote:
Are you root? You have to be root to edit httpd.conf. |
Quote:
the path of the actual files being included is: /home/newsfl/public_html/links/link.php and the path to the domains calling them varies, depending what I registered that day |
and yes, I am root, but I have little experience working in ssh
|
mlove, are you a server tech, and if so, what do you charge? and do you have references?
I have little shit like this that pops up every once and a while, and I would love to have someone on icq that could work with me on it |
Quote:
my aim is sdrawkcabyekim . No icq, email is [email protected] . |
You all patched up yet homes?
|
I'm leaving for sleep. If you still need help, send en email and I'll get to it in the afternoon.
|
Quote:
|
Quote:
|
Quote:
I will email you also, I would love to talk about what my best option is for this to keep my server load at the bare minimum I also want to speak with you about going through and optimizing my server |
Quote:
|
Hi Jace,
this really does not look the way you should be doing it. Why don't you just write a function in that .php file and include it only once? like this: Code:
<? |
Quote:
|
I always wondered the same.
I have a few thousand pages using phpinclude, I never really noticed any problems. |
Quote:
|
Quote:
I have about 20k pages across 50 or so domains, all of them in about 20 niches....I need to call one single url php file to rotate urls on those pages consistantly why would I include it only once when I have 20 locations on the page I need those urls rotated? |
You can rotate them in the function... As I understand you're always including the same .php, right? And this one .php does a rotation? Couldn't the function do the rotation? If you're including 20 different .php files, then disregard my previous message :)
|
Quote:
|
Quote:
then have url.php have <?php $link[1] = "somelink.com"; header("location: http://" . $link[$QUERY_STRING]); ?> |
madrox, he is trying to write the actual link rather than having a php call, it's all about making googlebot happy.
My question would be why not have your php module write the <a href part itself? then you could just call the module rather than calling inside of a link. That is very messy code. As others have mentioned, never use http:// inside an include. That means you server has to do a lookup (dns), make a connection (to itself, even worse) and use up available apache connection resources to serve you something that can be done directly in PHP without an issue. That will kill your server deader than a doornail in about 2 seconds if you get some hits on the page. Googlebot would be enough to make your server stop running. |
1. use cron to create file-to-include.txt every hr.
2. use readfile() instead of include() to 'include' file-to-include.txt |
all has been solved thank to munki :) he ROCKS
|
Quote:
I am going to try and implement that also |
Quote:
|
All times are GMT -7. The time now is 04:16 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123