Laragon - How do I serve a website on startup? - php

Right now I have to open laragon start all > go into commands > and write php artisan serve, only then can I access the local website.
My question is how can I start all and serve the website on start of the program.
Thank you in advance!

you have to put your project folder into C:\laragon\www\
when start the laragon service it's gonna search in that folder and use the name of the folder project to create a custom url, for example
if you put your project folder named newproject into the C:\laragon\www folder, when you start the service, laragon it's gonna make an url with the name of that folder newproject.test
C:\laragon\www\newproject-> newproject.test
C:\laragon\www\blog-> blog.test

Related

change laravel directory to www/cms/

Currently my directory is var/www/
but i have other projects in this directory .for example:
var/www/wordpress/
laravel tell me :
Sorry, the page you are looking for could not be found.
how can change laravel directory to var/www/cms ?
does work another project?
how can do that?
I commented earlier .. But I think to make the comment more clear I am going to go ahead and answer this:
First what you need to do is cd into /var/www/cms
Next you need to create your Laravel application. While in the cms directory, issue your Laravel creation command IE composer create-project laravel/laravel your-project-name. Once it is finished .. You should have a directory in the cms directory named whatever you named your Laravel Project IE var/www/cms/your-project-name.
You then need to point your hosts file (whether Nginx or Apache) to the directory var/www/cms/your-project-name for whatever domain.
I hope this was simplified enough for you, and good luck!
Laravel Valet could be one of the Solution.
You could create seperate Host for your Specific Application at Localhost.
Explained here : https://stackoverflow.com/questions/19425086/alias-hostname-for-localhost
You could Create new Directory and run your Laravel Project there too.

how to install laravel inside an addon domain

I have an addon domain like this :
/public_html/mysite
Site is available from the following address:
www.mysite.com
now I want to install laravel on this addon site.
I've copied all folders insdie mysite directory :
but when I enter www.mysite.com on my browser it shows content of my laravel project :
solved:
How to install laravel inside an addon domain
There are different ways you can install laravel inside an addon domain. Here is one of the easiest ways to do it.
Go to your CPanel and open Softaculous Apps Installer.
Look for Laravel Installer and open it. Carefully select the addon domain where you want to install Laravel.
Click Install. If there was no previous install then it would take 3-4 seconds.
Now go to the File Manager and open that specific domain folder. You will see All the laravel files there.
Now if you have an existing project that you want to upload on this domain simply make a zip file of your project and upload & extract inside this domain folder.
ONE LAST THING
When you install Laravel using Softaculous Apps Installer you get a redirect from domain to /public. To resolve this open index.php file (Not the one inside the public folder, one that is outside). Remove all the code from it and just paste the code given below.
<?php
header('Location: public/');
?>
And that is it. This should work for you.
Is it a shared hosting you're using if yes then :
Put the content of public (L5) directly on public_html (be aware of don't overwrite the .htaccess file accidentally)
Now in
then modify your index.php and your bootstrap.php and it will work just fine

Is there a way to create an Eclipse project excluding the project name in the path?

Not sure how I can explain this better as I am a beginner to Eclipse application.
I have my web directory set up for php pages. For example, /home/www/phpsite. All the source files exist here.
However, whenever I create a project (say 'myProject') and test any files from the existing path, it includes the project folder in the path name:
/home/www/phpsite/myProject/index.php
and this results 'Not Found' error.
How can I run my php pages in /home/www/phpsite/index.php? The project folder name is always included in testing web pages.
I am not trying to use the workspace directory created by Eclipse. I'd like to code and modify pages directly from Eclipse to my web directory.
Thanks
Follow these steps:
Setup www as your workspace
From the menu: File -> Import -> General -> Existing Folder.....
Promote to project:
Choose project type: PHP
Browse for "phpsite" and finish.

Yii framework installation

I am new with yii framework. I have downloaded yii-1.1.14.f0fee9.zip file, I extracted and renamed it as yii and placed to my wamp root directory. For creating sample skeleton application, first I created test_project folder in wamp root and then run folling lines to cmd prompt.
cd c:\wamp\www\yii\framework
yiic webapp ..\test_project
these lines executed in cmd prompt without error. But, could it see create any sample or skeleton files under test_project folder. I have also tried to run it with browser. It showing blank. Anybody can please help me to start a skeleton project in yii ? Iam really interesting to develop projects in yii. please help me guys.
Follow the steps
cd c:\wamp\bin\php\phpx.x.xx
c:\wamp\www\yii\framework\yiic webapp c:\wamp\www\test_project
Note that in step 1. is your php directory that has php.exe file
Update:
For detail you can have a look at this link http://www.larryullman.com/series/learning-the-yii-framework/
This is a very good tutorial for Yii application initiation.
hope this will help
I've never used wamp but as I see it has a WWW directory. You should place your projects in this directory, otherwise it won't be available for browsers. (Never take the framework files here, just leave there than you placed before)
Using yiic. It is a command line tools (doesn't work from browser) for making skeleton app, migrations etc.
try:
cd (c:....... framework) [enter]
yiic webapp c:\......\www\test_project [enter]
The main are points the WWW and the separated command
I guess it will work.
Greg

How to add project to Netbeans when all source files are not in webroot?

The directory structure of my project is like this:-
/var/www/includes/
/var/www/classes/
/var/www/public/css/
/var/www/public/js/
/var/www/public/index.php
The webroot is /var/www/public, so accessing the test domain localhost.dev would serve the files inside the public directory and hence would run /var/www/public/index.php. No need to access like localhost.dev/public/index.php
The problem is when I create the project in Netbeans, I have to set the index file so that the project can be debugged using xdebug and Netbeans.
So when adding the project I provided /var/www as Project source folder (Sources Folder) as the includes and classes are in this folder. In the next project configuration screen (Choose Project > Name and Location > file path is taken as Run Configuration), I'm asked for the Project URL and the index file. Since the index.php file is actually under the /var/www/public/, when I browse the file and select it, the url to index page is taken as localhost.dev/public/index.php instead of just localhost.dev/index.php. This is preventing me from debugging the project.
Can anyone please point out how to add projects to Netbeans when all the source files are not in web root and the project is to be debugged using xdebug.
I think its a bad practice to put all the project files directly in /var/www.
I think you will never see that in real deployed projects. So my first recommendation will be to change the way you are structuring your project. If that's not possible, in Netbeans select /var/www/public as the Project folder.
If Netbeans need references to the folders in /var/www, create symbolic folders inside public pointing to those in /var/www.
The last resource you have is to create a rewrite rule in Apache to make localhost.dev/public be the same as localhost.dev. You can look for this in Apache documentation.
I have a similar set up with one minor difference: my setup uses a remote site on my local development server. On the "Run Configuration" window of the project properties, I set "Run As" to "Remote Web Site (FTP, SFTP)". I don't think this affects the information in my answer, but I'm mentioning it just in case.
Go to the "Sources" window of your project properties, find the entry for "Web Root", click "Browse" and select the /var/www/public directory. That should cause xDebug to use localhost.dev/index.php. You'll notice when you go to the "Run Configuration" window and browse for the Index File that the browse window will start in "public" rather than "www".
An important note about this type of configuration that caused me a great deal of frustration.
When using xDebug, you'll want to be able to set breakpoints in and work with the files outside of the web root (public) directory. Because you've set the web root to /var/www/public, you won't be able to work with the files in /var/www/includes or /var/www/classes.
The thing you need to do is to add the files outside of your web root to the Global Include Path.
There are two methods for adding directories to your Global Include Path, which one you use depends on how you've configured your project.
In your case, the external directories are included in your project, so you need to add them via the "Options" interface. Go to Tools->Options and select the "PHP" tab, then add the /var/www/includes and /var/www/classes folders to the Global Include Path.
The other method for adding files to the Global Include Path is for files that are located outside of your project source folder. For directories like /var/folder_outside_www/, you use the "PHP Include Path" window in the project properties.
I haven't found a better way but I use this steps:
Menu:Project Properties -> Link:Run Configuration -> Button:Advanced
Debug URL, choose: Ask Every Time
Path Mapping, Server Path: http://localhost.dev/ ,Project Path: /var/www/public/
Now, when you start Debugging process, Netbeans will display Specify URL pop-up which you can change from http://localhost.dev/public/index.php into http://localhost.dev/index.php
Set /var/www/public as project folder (contain netbeans project folder) and include in project properties /var/www/includes/ and /var/www/classes/ as global include directories. Or best way use PHPStorm.

Categories