I am new to laravel and i have download voyager admin panel for CRUD operations.
actually my folder structure is
testadmin(project name)->vendor->tcg->voyager
when i hit php artisan serve i got http://127.0.0.1:8000 and http://127.0.0.1:8000/admin i will get my admin panel
Can i get the same url without using php artisan serve?when i hit localhost/testadmin/public i got laravel page and http://localhost/testadmin/public/admin i will get admin page but complete css is missing.how can i access my admin page without artisan serve?please help me.any help would be appreciated
You can use Valet or Homestead
I don't know if you are on Windows env, but I am sure there is an option on Windows too. Artisan serve is for quick checks, I wouldn't use it for development.
You need to change the httpd.conf file in the /etc/httpd/conf/ folder, if you are on linux.
Uncomment or add the line Include conf/extra/httpd-vhosts.conf so that you can add your own virtual hosts
Then in the file change /etc/httpd/conf/extra/httpd-vhosts.conf Add the following lines
<VirtualHost *:80>
DocumentRoot "/var/www/html/testadmin/public"
ServerName YOUR_WEBSITE_NAME
</VirtualHost>
then save. now restart the Apache server
service httpd restart
Hope this solves your problem. this may be a bit complex but i tried something similar on windows and it worked.
Related
I'm experiencing the problem discussed in this thread: New xampp security concept: Access Forbidden Error 403 - Windows 7 - phpMyAdmin
To solve it I apparently need to make some changes to the httpd-xampp.conf file. I however don't know how to locate it.
Are you guys sure you mounted /lampp?
XAMPP Volumes
If not, please do so.
Then open file at
lampp/etc/extra/httpd-xampp.conf
and edit it at line 20 and add a new one at 42 like this:
# since XAMPP 1.4.3
<Directory "/opt/lampp/phpmyadmin">
AllowOverride AuthConfig Limit
Require all granted
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
and
# <Location /time>
SetHandler modperl
PerlResponseHandler Apache::CurrentTime
Require all granted
Start XAMPP again (mounting of lampp not necessary anymore) and you are good to go.
use find command to know the location of httpd-xampp.conf. enter the following command:
$ sudo find / -iname "httpd-xampp.conf"
Is not that located at: etc/extra/httpd-xampp.conf ?
If not, then just create it, and in the main .conf file (httpd.conf) file, insert such line:
Include etc/extra/httpd-xampp.conf
It is located in the virtual machine running xampp, not the physical hard drive. That being said, I cannot find mine either and am simply using http://localhost:8080 to access phpMyAdmin until I find httpd-xampp.conf.
Having issues setting up xampp on macOs or accessing the config.inc.php or httpd-xampp.conf file.
Note: For macos xampp making use virtual machine under the hood to mount the folder structure on your system.
step 1: you need to follow the instruction step by step on the screen below,
it has image illustration which helps alot
https://www.apachefriends.org/blog/new_xampp_20170628.html
step 2: Click on network tab within the xampp interface then enable one of the
host machine.
step3: Click on the volume tab within the xampp interface then click on mount
then click Explore to have access to the xampp folder or files likes of config.inc.php or httpd-xampp.conf
guys I have a laravel project and its working fine. Every time I start the project by typing the command php artisan serve and then by typing the url localhost:8000 in my browser. But now I want to start my project only by typing the url localhost/projectname.
So I did a little bit of digging and found out a way to do this, I made it possible by changing the server.php file from root directory to index.php and copying the htaccess file from public folder to root directory`. This way my browser loaded only html file or php file but css files and js files were not loaded so I had to modify there link on the blade file for example:
Previously a style.css file was linked as:
<link rel="stylesheet" type="text/css" href="{{asset('front_end/assets/css/style.css')}}">
Now I link the same style.css file as below:
<link rel="stylesheet" type="text/css" href="{{asset('/public/front_end/assets/css/style.css')}}">
And It works fine.
But now I have found another problem, I have stored some files (images) in the the storage/app/public/myfolder directory so to access the files I had to use the command php artisan storage:link command and to access the files(images) from above mentioned directory from blade file I use the code below:
<img src="{{$url = Storage::url('myfolder/'.$company->logo_name)}}">
This code did worked only worked when I used to start my project using php artisan serve command. Now I its not linking so what should I do? And also can you guys tell me the way that I changed the server.php file to index.php is the right way or not? And what you guys do in your real projects?
Thank You.
When deploying a Laravel project you want your nginx or apache configuration to point to your public path of your project. Changing the server.php or index.php files are not necessary.
Apache Config Example:
<VirtualHost *:80>
ServerName project.dev
DocumentRoot "/home/vagrant/projects/project/public"
<Directory "/home/vagrant/projects/project/public">
AllowOverride all
</Directory>
</VirtualHost>
As you can see with this apache config example, it points to the public directory of your project.
You can achieve this locally by installing either Apache or nginx on your local machine.
I would recommend following Laravel's documentation guide on using Vagrant's Homestead to get an idea of how this is working before you decide to run this on a server. A link here
There is a couple of options you can take to achieve essentially the same goal. This depends on the machine you are running on and personal preference.
Laravel Valet for Mac
Laravel Homestead
WAMP for Windows
MAMP for Mac
You don't need to modify any file.
You need one of this:
Web server installed locally, Apache or Nginx
A Vagrant Virtual machine for running the project like in production environemnts like Homestead
Valet
If you decide to go with Web Server, you just need to consider to point to project/public folder instead of project.
Doing with one of this options, you won't need to modify the assets url, since public shouldn't be part of your url in any case.
First of all, don't do any tweaks in server.php file, it's fine.
To run your project with url like, http://localhost/my-project.dev or simply my http://project.dev, use WAMP or XAMPP (if working on a windows machine) and lamp for linux. You can also checkout Laravel's Homestead.
Then setup virtual host.
See this tutorial for setting up virtual host on WAMP - http://www.coderomeos.org/how-to-set-up-virtual-host-on-wamp-server
And don't put your assets in public/assets folder to prevent using storage link.
I've use php artisan serve command the project has loaded successfully in laravel 5.2 but if i load http://localhost/projectname/public/ it has shown blank white page.
How can I run my laravel 5.2 app using http://localhost/mydemo/public/ this url
You should set up your web server so public directory would be set up as root directory.
For example, you're using Apache, you should do something like this:
<VirtualHost *:80>
ServerName myapp.localhost.com
DocumentRoot "/home/vagrant/projects/myapp/public"
<Directory "/home/vagrant/projects/myapp/public">
AllowOverride all
</Directory>
</VirtualHost>
And don't forget to restart your web server after you do this.
Try running the PHP built-in sever directly from your public directory. You can check the PHP doc page for more details, but you should be able to cd into your mydemo/public directory and run php -S localhost:8000. Then open localhost:8000 in your browser to view the page. If you haven't made any changes to your routes.php file, then the default Laravel welcome page should display.
If that doesn't work, I recommend watching the episode 1 and 2 of the latest Laravel From Scratch series on Laracasts. Jeffrey walks you through all of the setup and uses 'php artisan serve' early in episode 2 to load the built-in server.
Good day friends,
I know that similar questions exist for deploying a Symfony 2.7 application on shared hosting with CPanel. But in my case I do not have access to SSH. Therefore installing via Composer is out of question.
To work around it I have copied the entire sources into a sub folder in "public_html" folder. When I try to configure Symfony using "web/config.php" it gives some pre-requisites issues. To resolve this I have copied custom "php.ini" in my sub folder and also added the ".htaccess" file to root of "home/user" with following content
SetEnv PHPRC /home/user/public_html/subfolder/php.ini
But still the setting is not taking affect. Do i need to ask the hosting provider to restart the web server ? this wont be easy since it is shared hosting.
Please suggest any alternative way
Your custom .htaccess is not used by the application.
Try to add the SetEnv in the public_html/web/.htaccess that is used to browse your application.
If this has no effect, a working way is to add the following in the VirtualHost of your application:
<VirtualHost *:80>
PHPINIDir /home/user/public_html/subfolder/php.ini
</VirtualHost>
But that involves to restart apache once.
EDIT
If PHP run as CGI:
Create a wrapper script called phpini.cgi to export the directory that contains the php.ini file as PHPRC.
#!/bin/sh
export PHPRC=/home/user/public_html/subfolder
exec /path/to/cgi-bin/php5.cgi
In your /home/user/public_html/web/.htaccess add the following lines:
AddHandler php-cgi .php
Action php-cgi /cgi-bin/phpini.cgi
If php run as CGI with wrapper (for FASTCGI):
You should already have the following wrapper script:
#!/bin/sh
export PHP_FCGI_CHILDREN=3
exec /path/to/cgi-bin/php5.cgi
Change it to:
#!/bin/sh
export PHP_FCGI_CHILDREN=3
exec /path/to/cgi-bin/php.cgi -c /home/user/public_html/subfolder/php.ini
More informations and alternatives in the source.
I hope this solves your problem, it should if you are sure you are php run as cgi/fast-cgi.
Maybe some one know the solution for my problem.
In localhost all works fine.
I bought vps server, install Ubuntu, and LAMP stack in it.
And now copy all files from localhost to live server, threw ftp.
I write ip/public in web browser and I see my projects mine path running well, but if I wanna go to url like ip/public/login it throws 404 error. (Now working only public address)
.htaccess in public folder is good.
Now I find If I write ip/public/index.php/login it works well, but I need that it work like in localhost
Try making a symbolic link to your public folder and using that as the URL of your project. For example, I have a project called inspections in my /var/www/html folder. If I try to access http://url/inspections I get an error:
403 Forbidden: You don't have permission to access /inspections/ on this server.
However, after calling this command:
ln -s /var/www/html/inspections/public /var/www/html/insp
And navigating to http://url/insp the page displays properly and everything works fine.
Another thing to keep in mind is that app/storage need to have write access (at least) in order for Laravel to work properly. I usually just do:
sudo chmod 777 -R app/storage
To activate all privileges and go from there. Hope that helps!
Also did you check if mod_rewrite is enabled on this server?
Maybe Overwrite is not defined for this folder?
Try:
<?php in_array('mod_rewrite', apache_get_modules()); ?>
Or this:
<?php die("Enabled: ". strpos(shell_exec('/usr/local/apache/bin/apachectl -l'), 'mod_rewrite') !== false); ?>
And check if Allowoverride is enabled in your virtual host file.
The location of the file depends on the operating system and structure.
It should look a little like this:
Options Indexes FollowSymLinks
AllowOverride All
Require all granted