I have a different app runnning in localhost:8000. If I run a second app through the server, it dumps the one running and it places itself in this port. I need to be able to run both. Ideally in separate ports:
App1 in localhost:8000 Which runs a React/webpack/node app
App2 in localhost:8080 Which runs the PHP version of the site.
I'm using atom as my IDE with a built-in command terminal if that helps. And Apache as my local server (XAMPP and WAMPP in mac and Win respectively)
I found the way to do it without having to do much work creating VirtualHosts and using PHP Built-in Server
Step 1 - Open your XAMPP console and click on the Shell
Step 2 - CD to $PATH. For example cd c:\xampp\htdocs\site_folder
Step 3 - Type php -S localhost:8080 and hit Enter
Step 4 - In the browser, navigate to localhost:8080 and it will show.
Step 5 - For the second website, open a separate CMD terminal and repeat the process by selecting the $PATH to that website folder and assigning a different port numbe (i.e 8000), hit Enter, navigate to that localhost:8000 in a separate browser tab or window and voila! Now both sites are running independently!
Related
I'm running a Laravel app with php artisan serve. When I start it from the CLI, it works the first time fine. But when refreshing the URL, it stops responding and the link becomes pending in a loop in Chrome's Inspect Network tab. Then when I close the CLI and reopen it again, it works fine again the first time, but still doesn't work when restarting the server only.
But when I run the app from the www folder in WAMP it works fine.
So what's the problem?
Is it with the env file?
If you are using the latest version for Laravel 5.X, you will see that sometimes the php artisan serve command doesn’t work properly. If you face this type of problem, you can use the below command and start your server locally.
So there is a different solution: you can use your php cli server command instead of the artisan command
php -S localhost:8000 -t public/
make sure that your PHP is in your global variables
There's a lot info in the internet about docker's base operations: "how to pull image", "how to run/start container", but almost nothing about what to do next with it. How to develop?
For example, I pulled linode/lamp. Simple project is lying in /var/www/example.com/public_html/.
I launch: docker run -p 80:80 -t -i linode/lamp /bin/bash, service apache2 start. Now, in my browser in http://localhost I see an index page of the project.
Now I want to edit/add/delete files in the project. Do this with bash and nano is insane, obviously. Therefore I want to use PhpStorm. And I cannot understand what to do.
What option should I choose to create a project?
Web server is installed locally, source files are located under its document root.
Web server is installed locally, source files are located elsewhere locally.
Web server is on a remote host, files are accessible via network share or mounted drive.
Web server is on a remote host, files are accessible via FTP/SFTP/FTPS.
Source files are in a local directory, no Web server is yet configured.
it the first, then where shoud I get files? If "via FTP/SFTP/FTPS" - how to set up? I don't get it.
I know that PhpStorm has Deployment - Docker settings and I can configure it. That how it looks on my machine:
Docker settings Image
Debug/Run configuration Image
But it only gives an ability to start containers, connect to them via console. Shoulв I use it somehow?
Docker Image
Please, explain me, what should I do? I would like to see the answers for Windows и Linux (if there is a difference, of course)
P.S. I use Docker on Windows. But in Settings it's switched to Linux containers.
I'm trying to run a simple Laravel project inside a Vagrant (VirtualBox) VM. The guest is Ubuntu 14.04 x64, and the host is Windows 7 x64. I've set up port forwarding (8000 on host to 8000 on guest), but when I run php artisan serve, though I get a message stating that the server is running on port 8000, when I visit localhost:8000 on my host machine, Chrome tells me 'this webpage is not available'. There are two complications:
First, if I use curl from inside the VM, I receive the correct page contents - so it appears the server is working fine.
Second, if I run a Python web server using python -m SimpleHTTPServer on the same VM, I can access it fine on my host OS. Visiting localhost:8000, I see the directory contents listed. So it appears the port forwarding is working fine.
I tried deleting the public/.htaccess file in the Laravel project, to no avail. I'm no PHP expert, and this problem is hard to Google! Any pointers would be appreciated.
After reading this question I tried
php artisan serve --host 0.0.0.0
And it works fine now.
Does the PHP built in web server allow multiple instances/sites?
Background on the project skeleton
I am working through Zend for the first time via Chrisopher Valles' tutorial.. with a slight difference. He uses Vagrant to instantiate a VBox instance, and I'm working locally in Ubuntu 12.x LTS...
https://github.com/christophervalles for more details on the Vagrant box...
I want to utilize the internal PHP 5.5 server if possible, but getting an error when (of course) running the 2nd call.
Is the best/usual solution to have the core service be on some variable port when in development, and run the web client on port 80?
I'd, of course, need to rewrite some of my client's code to point to the new port, but would the Zend Service need a rewrite anywhere? I'd say no.
Starting up my site's core/api services Zend project :
>php -S 0.0.0.0:8080 -t public/ public/index.php
PHP 5.5.10-1+deb.sury.org~precise+1 Development Server started at Day Date Time
Listening on http://0.0.0.0:8080
Document root is /home/core_site/public
Press Ctrl-C to quit.
Starting up my site's web client, that talks to the first server:
>php -S 0.0.0.0:8080 -t public/ public/index.php
[Day Date] Failed to listen on 0.0.0.0:8080 (reason: Address already in use)
you could just use a different port
php -S 0.0.0.0:8081 -t public/ public/index.php
Thanks for reading my book!
About your question, Andrew is right about using a different port. As far as I know you cannot do domain name based hosts on the built in php server. If you don't want to use different ports each time you should look into using apache or nginx.
If you go with nginx and php you can re-use the config files I use for the Vagrant machine so you don't have to do everything from scratch. Essentially the OS on the Vagrant machine is a Ubuntu 12.04 (the same as yours) so shouldn't be hard to re-use the configs :D
You can check out the php.ini and the nginx vhosts used on Vagrant here.
Cheers!
I have encountered a problem when trying to preview PHP files using the Xampp control panel Apache module. Basically I open the control panel, click 'start', and have it minimised on my screen. I then navigate to a PHP page that I want to preview in my browser - but when I try to load it, it just sits there and says 'Waiting for Localhost' on the tab. The page never loads. Has anyone ever encountered this problem before, and if so, is there a simple fix?
Regards,
Robert Young
This happened to me and the problem was that some other application was listening on port 80. I couldn't figure out what it was. Usually, it would be Skype so I shut down Skype and I still had a problem connecting to localhost. The other application was Audible Download Manager which automatically starts when I start windows and you can usually see in the windows task manager. Once I closed the app, localhost started working.
This is how you figure out which application is listening on port 80.
Go to Start, then Run or type cmd and open cmd.exe. Then type:
cd desktop
netstat -a -b -p TCP >port_list.txt
After command runs, port_list.txt will be saved on your desktop. Open port_list.txt and go through the list and find the application listening to :http. Then find the application under processes in your windows task manager and end the process.
I had similar issue... Here is what you can do:
Step 1: on xampp control panel checkout netstat & look if any other application is using that port as your xampp
( If yes then shut down those applications using Task Manager)
Step 2: Irrespective of Positive or negative results of step 1, Just Turn off your firewall through control panel.
In my case I just had to turn firewall off & it did the miracle.