I have the test.php file in this directory C:\xampp\htdocs. I can access the localhost by this link http://localhost:800/xampp/ then it appears the orange XAMPP wlecome window but when I type the following URL http://localhost:800/xampp/test.php I getting something as The required URL could not be found. Why can not I access this file?
Apache ports: 800, 4433
MySQL ports: 3306
test.php
<?php
echo "Hello World!";
?>
If you file is in C:\xampp\htdocs you should access it using http://localhost:800/test.php.
htdocs is the default root directory of apache. (Variable DocumentRoot in conf/httpd.conf)
1) Inside the htdocs directory crate new folder test and add file
test.php into this directory
2) Restart the server
3) Use
http://localhost/test/test.php
Related
I set up the environment path in amazon linux vi /etc/environment as ENV_TYPE=DEV. Environment variable are set up in localhost but it not get the environment in web host.
In apache path /var/www/html I create a index.php with below code:
<?php
echo "env ".getenv('ENV_TYPE');
exit;
?>
I already tried the below commands for setup,
vi etc/environment --> ENV_TYPE=DEV
OUTPUT from my host is " **env **" only but expected Output is "env DEV"
the issue is env only execute in this code , ENV_TYPE not fetched from environment variable!!!
output image
i expected output image is
set the Local environment in the path file /etc/environmet
export ENV_TYPE=DEV
then, save and Create a .htaccess file in the apache path /var/www/html and add the line in .htaccess file.
SetEnv ENV_TYPE "DEV"
Allow the .ht file permission in apache conf (httpd.conf) file
Finally, it's automatically taken the Environment Variable as Dev
I'm using Vagrant provider for server, now look at my directories :
in my system:
https://i.stack.imgur.com/XCXIm.png
vagrant-site
-Project(/var/www)
--public (/var/www/html)
---index.php
now I created a sample .php file in Project folder then when I run vagrant and logged in vagrant ssh when I cd to /var/www ,that .php file doesn't exist there and I could not work with
include __DIR__ . '/../count.html.php';
this line of code not working because this file doesn't exist in /var/www but exist in my system
That index.php file it's work there is no Problem , but I want to create a php file outside of public directory that , just my self can access that , now when I create that file inside Project folder so now this file must be inside /var/www and when I use include command in my php code , php can not found that , I used file_exists() function and gave the path of php file function , now the function returned false then I check /var/www directory to check that php file exist or not , not exist!
I solved problem,
in vagrant file in Sync folders config section , I found out I can add more directories so I synced : ./Project to /var/www but remember,
something it will change after sync ,this directory : /var/www/html ,
that html folder inside apache2 it will remove and replaced with your public directory name (inside your device ,for me it was public ) public directory folder,
and now you need to change your root directory address inside 000-default.conf file in this Path: /etc/apache2/sites-available/000-default.conf after you change this restart apache2 service
DocumentRoot /var/www/html change this => /var/www/your public directory name
sudo service apache2 restart
how run Laravel 5.5 project without localhost:8000 url?
my project name lms_manager
I want to load my project without localhost:8000 and php artisan serve command url and I want to load it localhost/lms_manager but I really don't know how do it,
please can I help?
You need to do some changes
1st : move lms_manager\public\index.php to main folder lms_manager\index.php
2nd : Change path in index.php you just moved, from
require __DIR__.'/../bootstrap/autoload.php';
To
require __DIR__.'\bootstrap\autoload.php'; In Windows
Or
require __DIR__.'/bootstrap/autoload.php'; In Linux
I assume you folder is inside htdocs so that you can run localhost/lms_manager
You need to do these changes on your files:
1) Goto C:\Windows\System32\drivers\etc and write this in hosts file
127.0.0.1 lms_manager.com (choose whatever name you like)
2)Goto C:\xampp\apache\conf\extra and write this in httpd-vhosts.conf file
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/lms_manager/public"
ServerName lms_manager.com
</VirtualHost>
I have a XAMPP local PHP server and I need use browser sync but I don't know how to run it WITHOUT gulp or grunt only using command line. I try to
browser-sync start --server --port 80 --files "css/.css"
but instead of port 80 it launch with 81 port
browser-sync start --proxy 'localhost:80' I tried this. It's connect to my localserver but doesn't refresh
You have an error in your --files argument. There should be an asterisk before .css to select all CSS files in your css directory, like this:
browser-sync start --proxy "localhost:80" --files "css/*.css"
Remember that the directory path should be relative to the current directory you're inside in your terminal/cmd window.
This means that if your server is running on localhost and CSS files can be found under localhost/css, it is NOT enough to just run the browsersync script above from any directory.
You have to navigate to your local server folder (usually C:\xampp\htdocs, where your real css folder is located) and run the browsersync script from there. Alternatively, if you don't want to change the directory in your console/terminal/cmd window, you have to specify the full relative path to your CSS files from your current directory.
Had the exact same issue, and I just had to run the script from the correct folder path.
I have 2 Laravel 4 applications.
I want one of them to be served from within a folder that is inside the other's root folder.
For example, let's say Application A is deployed to /var/www/ folder, and I want Application B to be deployed to /var/www/B/.
When just naively putting it there, I get an error NotFoundHttpException from Application A's RouteCollection.php.
Any idea how this can be achieved?
Thanks in advance!
I supose you're using apache2. There is a file in /etc his name is hosts, you can configure a virtual domain to access diferent directories like:
127.0.0.1 project1.com
127.0.0.1 project2.com
The you have to configure the virtualhost. You have to go to /etc/apache2/sites-avaible and copy the default config file 000-default.conf
cd /etc/apache2/sites-available
sudo cp 000-default.conf 001-laravel1.conf
sudo nano 001-laravel1.conf
Inside of the edit of the document you only have to change two things:
ServerName (you have to put your virtual domain) -> project1.com
DocumentRoot (you have to put your directory of your proyect) -> /var/www/A
And the last thing is create a symbolic link to this archive in the directory /etc/apache2/sites-enabled
cd /etc/apache2/sites-enabled
ln -s 001-laravel1.conf ../sites-available/001-laravel1.conf