Which one is better and why? Can someone please explain it to me? Thanks a lot.
//Example 1
if($var == 1)
{
echo "text text text..."; //Note: large text like 1MB
}
or
//Example 2
if($var == 1)
{
echo file_get_contents("path/to/file"); //content of this file same as echo text above
}
If you're serving a whole megabyte of static content, definitely let Apache do it -- it can use the sendfile(2) system call to avoid double-copies, doesn't force PHP to reparse a giant
I want to change XAMPP's htdocs directory. I followed the instructions to create a virtual host from this question:
Make XAMPP/Apache serve file outside of htdocs
this works fine on Windows 7, however when I try it on OSX, going to mysite.local just loads the xampp splash screen (mysite.local/xampp/index.html). I have restarted the web server. My virtual host declared in httpd-vhosts.conf is:
<VirtualHost *:80>
DocumentRoot Users/username/Documents/sitename.com
ServerName
I'm trying to host a python script using an apache web server, but the server tries to run the script instead of just offering it for download.
I do not have direct access to server, and adding the line
AddType text/plain .py
to .htaccess in the root folder does not appear to work, though I could be doing something wrong.
How do I get the server to just send the file as text instead of trying to run it?
-Edit
Changing the name does not work. Script.py.safe still give a 500
so suppose my server is located in http://www.example.com
I then put a file file.exe in the files directory in the root server hence normally you can download that file by typing this into the browser
http://www.example.com/files/file.exe
And suppose that I have a php script that first authenticates the user and then redirect them to that file.exe download page
eg. using this method:
header('Location: http://www.example.com/files/file.exe');
exit(0);
what is the best way
On my Apache 2.x server at home, I have a number of virtual directories. I've set up my router so that I can access Apache from the internet. I need to keep one of those virtual dirs (/private) from being accessed outside my home network LAN. So given /private, how do I configure Apache to only serve requests to /private from 192.168.4.x?
<Directory /users/me/private>
Order deny,allow
Allow from 192.168.4
Deny from all
</Directory>
I'm looking for a way to display errors that apache generates under
/var/log/apache/error_log
for my colleagues who are working on the same project. The coding language is php.
First I tried to do a simple php readfile script, but since the file is only visible too the root user i was unsuccessful. I do not want to use things like cpanel or kloxo. can anyone help ?
To answer this properly we'd need to know a lot more about your setup.
/var/log/apache/error_log
Kind
I am have a requirement wherein I need to route between two platforms based on the element value of the incoming xml requests.
If the text for the element is like: <name>Websphere</name> then I need to route the message to host1.
If the text for the element is like: <name>oracle</name> then I need to route the request to host2.
host1 and host2 are two instances of weblogic application servers. There is a apache http server in front of these two weblogic
Possible Duplicates
how can I use mod rewrite to redirect a folder to a subdomain ...
Apache rewrite based on subdomain (backwards)
I have catch all rules set up and a subdomain working fine.
However it's still possible to get to a part of my site from http://example.com/subdomain rather than http://subdomain.example.com/
How would I force a permanent redirect?
I'm assuming it's something like:
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
# (rule to see if i am inside
I've never experienced this error since I use Docbook. I've looked it up and found out that this error was fixed earlier in the past (and also I gave a try to do the same steps as it was explained). Unfortunately, I haven't managed to fix it on my own yet.
Here is the error message that FOP gives:
WARNING: The following feature isn't implemented by Apache FOP, yet: table-layout="auto" (on fo:table) (See position 2:182518)
2011.10.19. 11:19:37
The following function breaks with the regexp I've provided in the $pattern variable. If I change the regexp I'm fine, so I think that's the problem. I'm not seeing the problem, though, and I'm not receiving a standard PHP error even though they're turned on.
function parseAPIResults($results){
//Takes results from getAPIResults, returns array.
$pattern = '/[(.|n)+]/';
$resultsArray = preg_match($pattern, $results, $matches);
}
Firefox 6: The connection was reset
Chrome
When a user creates a wall on facebook for example, is there a whole new php file that is created containing the users infomation, or is their just one php file that uses mysql to gain and display the information about the user.
The reason I ask is because I notice that instead of the end directory in the url being one common php, it is always different.
Examples:
www.facebook.com/Engineering
www.facebook.com/lilwayne
Even youtube does it:
I am trying to write a script that will provide XML data to a third party client. I wish to require that all clients are authenticated in order to make use of the system.
Rather than using a bespoke authentication system, which would be overkill, I want client applications to just pass in their credentials via the url, such as http://myusername:mypassword@mysite.com/. This is not unlike how it is done in FTP.
I think this is possible using .htaccess, but when I do try it, I still