I've setup my apache server on Centos 6.4 . But when i run my page, browse displayed Apache test page, What wrong i did?
In /var/www/vhosts/testing.page, my file "index.php" is:
<?php
echo 'Welcome, Trien';
?>
My virtual host:
![virtual host][1]
And my page displayed:
![Browse display][2]
Any help?
thank
Delete the index.htm or index.html if exist.
Also, check the permission for the file, make sure it has 'execute' permission.
Related
First of all this code is working on my previous shared host now I'm moving to vps with ubuntu 16.04, php7, apache 2.4.18
this is my htaccess
RewriteEngine on
RewriteRule ya/(.*) ya.php?var=$1
my php code
$theya = $_REQUEST['var'];
When this working let's say people type http://mysite.coco/ya/ct1234
it will catch the var "ct1234".
I can echo it just fine
<?php echo"$theya"; ?>
Now it won't... Is my code incompatible with the apache or php7?
Thank you
edit: a wordpress with permalinks can run just fine on this server.
Is .htaccess enabled for your directory at your shared hosting provider? At least AllowOverride FileInfo should be set for your directory in the Apache Config.
P.S. Please never echo user input without escaping/encoding, would be a possible XSS otherwise.
Ok, brand new Windows 10 Installation without IIS or Skype (Port 80 is open).
Installed WAMP 3 64bit version Worked like a charm!
Changed the httpd.conf file so I could redirect the www folder to D:/www/
Deleted the Old www folder and copied all my projects to the new folder at D:/www/(each project within it's own folder) leaving www root folder without a index.php or any other type of index file
Ok now comes the problem... Restarted all services, and when typing localhost or http://localhost/, on any browser, it gives me 404 Not Found...
If I try to access localhost/site1/ (for example) everything works fine so WAMP is working...
But...
On Linux it used to list all folders so I could click on them like a dir list a sort of navigation structure...
Why Wamp is not doing the same?
Maybe something to do with .htaccess? And if So, how to resolve it?
Thanks in Advance
JohnnyBR
This is not an answer to this problem but it works! It's a bypass!
After reading all guides I could found, creating .htaccess files, changing conf files and everything, I couldn't fix this problem (I didn't wanted to try understanding virtual hosts... If I got that right I'd have to make a virtual host for each site... not the thing I want)
So I made a quick fix and here it is:
I created a index.php with this code
<?php
$d = dir(".");
echo "Path: " . $d->path . "\n";
echo "<ul>";
while (false !== ($entry = $d->read())) {
echo "<li><a href='{$entry}'>{$entry}</a></li>";
}
echo "</ul>";
$d->close();
?>
And that's it folks! Same effect! If apache is not helping nor wamp server PHP will do it!
I've recently got a VPS server and it came installed with CentOS, WHM and cPanel. I'm trying to find where the physical folder location the root URL of the server IP is being served. When I go to the root IP in a browser, I get a redirect to "/cgi-sys/defaultwebpage.cgi" with "SORRY!" and some error resolve details.
The server has a web-site running under "/cPanel" and also WHM runs on ":2083".
I'm trying take control of the content served directly at the /, and replace that defaultwebpage.cgi with an index.html.
I've tried httpd -V to check where the httpd.conf, is and then spotted a <VirtualHost *> in that config file, which points to a DocumentRoot of /use/local/apache/htdocs . But if I place index.html in this folder and try to hit it via /index.html, I still get routed to that defaultwebpage.cgi. Can anyone help me understand why its rerouting and not picking up that index.html?
Thanks.
You may want to try /var/www/html, at least that's in Ubuntu
If it's not it, then try going to /etc/apache2/apache2.conf and find the DocumentRoot option.
Hope this helps!
My local Apache server doesn't run my php file, instead the web browser downloads it when I try to view it. I'm using LAMP on Ubuntu. Would you help me how I can solve this problem? Thank!
Did you tell LAMP to handle .php files with the php5_module?
Check your current php setting by creating a new php file in the htdocs or www direectory with the following content:
<?php phpinfo(); ?>
This will show you if your webserver can process php files or not
I have not done any web dev before. I got my Apache server running on mac OS X, and set up a virtual host at /Users/dan/webapps. So, when I go to http://localhost/ in my browser, my index.html in the webapps folder shows up, as expected.
I then created Users/dan/webapps/temp/ folder, and put a flash app in there, let's call it "test.html", along with the required "test.swf". I restart the server. However, when i put http://localhost/temp into my browser, I get File Not Found. How do I make the browser able to go to that directory, and when it goes there, have it start test.html. I am using Safari. Thanks.
you should type: http://localhost/temp/test.html
a full path to your page,
Or you can change the name of your page from test.html to index.html and it would be loaded when you enter http://localhost/temp/, since the default DirectoryIndex is index.htm or index.html
Create a .htaccess file in Users/dan/webapps/temp/, and add the line:
DirectoryIndex test.html
This will make apache look for test.html when someone accesses the directory. Make sure permissions/ownership allows your webserver to read this file.