I've been trying to connect my local files to my app using `heroku local web`, but it throws this error:
3:24:15 AM web.1 | 'vendor' is not recognized as an internal or external command,
3:24:15 AM web.1 | operable program or batch file.
[DONE] Killing all processes with signal SIGINT
3:24:15 AM web.1 Exited with exit code null
I'm sure my Procfile is there in the directory and here is the command line web: vendor/bin/heroku-php-apache2.What I'm doing wrong? What is vendor and why it's not recognizing it?
Additional info:
OS: Windows 10
buildpack: PHP
Based on the error message, it looks like you're running this in cmd.exe. Commands there often use forward slashes for options (e.g. foo /a /b) instead of dashes (e.g. foo -a -b).
I believe the slashes in your command are being interpreted as options, making vendor the command that would run.
A common pattern for using a different command local development on Windows is to create a file called Procfile.windows containing a Windows-specific command, e.g. one that uses backslashes instead of forward slashes, and then run locally as heroku local -f Procfile.windows.
But that heroku-php-apache2 binary is unlikely to run on Windows, so that will be insufficient. The getting started with PHP page is notably missing the "run the app locally" step that, for example, the Python page has.
One good option is to use Windows Subsystem for Linux to run a Linux distribution in Windows and develop there. Another might be to use something like Docker or Vagrant to run a development environment in a virtual machine.
Or, if you have PHP installed on Windows already, try using something like php -S instead of Apache:
web: php -S localhost:8000 -t main_folder/
Make sure to keep your existing Procfile as you'll want to use that on Heroku. php -S should only be used for local development.
You might also simply have better luck using PowerShell instead of cmd.exe. It is generally much better-behaved.
Related
I would like to configure PHPStorm so that I can run Artisan commands directly from my IDE's terminal. For example php artisan key:generate. However, when I do, I receive the error 'php' is not recognized as an internal or external command.
Background:
running Windows 10 as host machine
using Docker to run my webserver (Nginx) and PHP interpreter (7.2-fpm).
I followed this tutorial.
https://www.digitalocean.com/community/tutorials/how-to-set-up-laravel-nginx-and-mysql-with-docker-compose.
One thing the tutorial didn't cover was how to set up my remote PHP CLI interpreter. For that, I followed https://www.jetbrains.com/help/phpstorm/configuring-remote-interpreters.html and can make a successful connection as it picks up the correct PHP version 7.2.21 as seen in the screenshot.
After this, I restarted my Windows 10 host machine, fired up the container, opened my IDE and tried to run php -v from the terminal but hit the error again.
I know it has something to do with my PATH environment variable being set incorrectly, or not at all but I am not sure how to point it to the container's PHP interpreter. Any help would be greatly appreciated.
EDIT
For what it is worth, I know that I can exec into the container and run PHP commands from there, but thought I might be able to do it directly from my host machine by pointing to the container's interpreter.
The terminal in PHPstorm is the same as any other terminal on your computer. It doesn't automatically connect to docker to run the php -v command. If you want to run php from PHPstorm in docker you can right click the file:
Choose run:
And select your created docker interpreter as your runtime:
If the fix button doesn't show it can be configured through:
settings > Languages & Frameworks > PHP
And then clicking on the 3 dots at the end of "CLI interpreter"
I'm trying to configure Heroku Local on a Windows 10 machine.
Composer, php, git, and heroku are installed fine, and my procfile look like this:
dev: vendor\bin\heroku-php-nginx -i php.conf.ini -c nginx.conf.php
but when i try to run, give me this error:
dev.1 | 'vendor\bin\heroku-php-nginx' is not recognized as an internal
dev.1 | or external command, operable program or batch file.
[DONE] Killing all processes with signal null
Exited with exit code 1
seens like windows can't run the bash file of heroku-php-nginx?
https://github.com/heroku/heroku-buildpack-php/blob/master/bin/heroku-php-nginx
What i can do?
I'm trying to start use selenium server with my Yii2 project.
I successfully installed selenium-server-standalone on win 10 with that command:
composer global require se/selenium-server-standalone
But when I try to start selenium-server-standalone I have error message::
sh is no internal or external
command, operable program or batch file.
There is java and selenium in my PATH, also I have a selenium-server-standalone.bat file in C:\Users\***\AppData\Roaming\Composer\vendor.
Please, tell me how can I solve this problem.
You have mentioned you are trying to run selenium server on Win10 machine and error you are facing is sh is no internal or external command, operable program or batch file.
Seems you are typing sh selenium-server-standalone.bat in your command. that is for Linux.
For windows machine, simply go to your path where batch file is located (C:\Users\***\AppData\Roaming\Composer\vendor) , type selenium-server-standalone.bat and hit enter. Selenium server will start.
I am developing a PHP app on Heroku. Is it possible for me to use Foreman to test my application? Everywhere I look I find references to Ruby, but nothing for PHP.
Yes, using PHP 5.4 built-in web server:
sudo foreman start -f Procfile_dev
And in Procfile_dev:
web: php -S 127.0.0.1:80 -t /path/to/doc/root
This is how I develop locally. I also have a line worker: watchr watcher.rb that listens for file changes to combine/minify JS, compile SCSS, etc.
You could probably add db: /usr/bin/mysqld or similar to start mysql if need be.
ALSO: you'll want to install the Heroku Config add-on, which will write the app config keys to a .env file that Foreman will send to php server on startup (accessible via getenv just like on Heroku.)
I would like to ask if I can run a php without having installed a web server. Do I have to use the php like CGI and run my page via command line? And if so, what are the steps that I do I have to choose through the installation of php? I mean the preferences as CGI and the components after that step?
I installed the php 5.3.3 but is seems not working, I get several message that the php5ts.dll is missing and when I put that file in my ext folder other error messages appear. Are there any configuration files or steps that I have to use?
(is php 5.3.3 suitable for doing something like this?)
If I have to have a web server installed how can I run my php code through the command line?
You should normally be able to run a php file (after a successful installation) just by running this command:
$ /path/to/php myfile.php // unix way
C:\php\php.exe myfile.php // windows way
You can read more about running PHP in CLI mode here.
It's worth adding that PHP from version 5.4 onwards is able to run a web server on its own. You can do it by running this code in a folder which you want to serve the pages from:
$ php -S localhost:8000
You can read more about running a PHP in a Web Server mode here.
For windows system you should be able to run php by following below steps:
Download php version you want to use and put it in c:\php.
append ;c:\php to your system path using cmd or gui.
call $ php -S localhost:8000 command in a folder which you want to serve the pages from.
PHP is a normal sripting language similar to bash or python or perl. So a script with shebang works, at least on linux.
Example PHP file:
#!/usr/bin/env php
<?php
echo("Hello World!\n")
?>
How to run it:
$ chmod 755 hello.php # do this only once
$ ./hello.php
You can use these kind of programs to emulate an apache web server and run PHP on your computer:
http://www.wampserver.com/en/
http://www.apachefriends.org/en/xampp.html