I came from frontend stack so I can misanderstand something when I'm learning symfony3.
I downloaded Symfony according to documentation with:
php -r "readfile('https://symfony.com/installer');" > symfony
To make php command available i added some values to the enviroment PATH variable (according to this tutorial: https://seiler.it/installing-symfony-framework-into-xampp-for-windows/ - step 2.3) like this:
c:\xampp\mysql\bin;c:\xampp\php;c:\xampp\php\PEAR;C:\xampp\php\symfony
As you see I'm using xampp for PHP development. I added that last, because i copied that downloaded symfony file to c:\xampp\php\symfony directory.
OK, now if i want to use symfony command, like
symfony new project
I need to go to directory where there is that symfony file and add 'php' before, like
php symfony new project
Because simple 'symfony new project' doesn't work (error msg tells about that command isn't known by Windows). How can i fix it?
In frontend there is something like npm (node package manager) with which you can install library/tool locally in directory or globally (to run it in terminal from any place on the computer). Is there is any equivalent in PHP development? I tried to install this by pear (from mentioned tutorial in step 7), but it installed me symfony 1.x version (and error of running that command was that there is no task like 'new') and i want to learn 3, not 1.
I tried to get composer, but i don't see where can i install there symfony globally.
So, how to run symfony globally? What am I missing?
From this doc:
In Windows, move the symfony file to a directory that's included in the PATH environment variable to create the global command or move it to any other directory convenient for you
idea
Install and use Git Bash. Gives you more futures then the windows CLI.
Performance
To run a ten times more fast environment for Symfony i prefer a Linux OS.
Related
I am trying to clone a Laravel project into VSCode and run the project on a local server. I have imported Remote - WSL, but it won't let me set up a composer. I get: this error message when using php command in the terminal
I don't know what to do from here. Is there any other way to simply clone a project?
A popular option is to use a pre-configured program like MAMP / WAMP / XAMP which gives you the stack you need to run php code locally.
Alternatively you can set up you local environment for php and solve the error you are getting...
The error suggests you need to install php globally on your system :
https://www.php.net/manual/en/install.windows.php
https://www.php.net/manual/en/install.macosx.php
And to install composer:
https://www.hostinger.co.uk/tutorials/how-to-install-composer
Ive been just starting to learn Symfony PHP framework, and Ive run into some problems with its configuration.
When trying to create a new project with command line like so:
symfony new --full my_project
I kept getting a simple error message:
no PHP binaries detected
and no files were created in the current folder. I searched on the net, and found out that Symfony apparently isnt able to find the location of my php.exe, despite it already being set in my system variables. And there was no information about how to properly configure this in Symfony.
How do I fix this error?
Turns out Symfony already contains functions to autodetect installed PHP versions from system variables. The command to fix the Symfony configuration is this:
symfony local:php:refresh
My next attempt to create a new project work fine after that.
Also, I suspect this error was the result of me installing PHP files after installing Symfony.
symfony local:php:refresh
doesn't always work. If your php is not in [/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /usr/games /usr/local/games /snap/bin] and a few other locations (check with symfony local:php:list -vvv) then symfony won't find it.
I compiled my own PHP from source and installed versions 7.4.20 and 8.0.7 in /home/username/php/7.4 and /home/username/php/8.0. If I want to use my PHP 8.0.7, then I have to make a symlink because updating the $PATH doesn't help.
sudo ln -s /home/username/php/8.0/bin/php /usr/local/bin/php
This works and symfony finds it.
Follow below steps:
Step 1: download & Install xampp in your system
Step 2: open the xampp folder.
find php folder and hit enter
Step 3: copy the path and paste in your system environment
Step 4 : run
php -v
you are good to go!
I've inherited a Symfony/PHP web app codebase with zero documentation. I'm a nodejs dev so you can image the fun...! Anyway I'm getting there, my focus atm is to be able to run the project locally.
Here's the Symfony version:
Symfony version 2.7.16 - app/dev/debug
I've installed packages via composer install.
I can start the web app locally via CLI:
php app/console server:run
Server running on http://127.0.0.1:8000
Quit the server with CONTROL-C.
However when I try to access this URL I'm seeing the following error in browser. Have google'd around but couldn't work it out so am hoping someone here can point me in the right direction.
I think this is due to trying to run a new version of twig on an old version of Symfony
as you can see here: https://github.com/symfony/symfony/issues/20284
They mention something similar, perhaps try to include an older version of twig in composer?
composer require twig/twig 1.23
I am Using my own Machine Kali Linux 2.0 Debian x64 . Now, i have Installed Laravel in my directory structure like
/opt/lampp/htdocs/learning-larvel/
Inside the Learning-laravel folder i have Installed my Laravel files, and also i installed composer. So when i go to http://127.0.0.1/learning-laravel/public . I see a See a White Screen and in Between it is written "Laravel 5", which means the Laravel GUI Setup is fine.
Now, to create a new file for Laravel, when i open my Terminal and type
laravel new xyz
then it gives me a error which says bash: laravel: command not found
Now, how can i fix the error.. I have researched about it by setting PATH to bashrc. But i am not getting it fixed right. Additionally when i type in my command composer -version then also it says bash: composer: command not found but i have Installed composer on the folder learning-laravel itself.
I could also see files like composer.phar there in /opt/lampp/htdocs/learning-larvel/
Any help would be extremely thankful.
As the composer official getting started page points out:
There are in short, two ways to install Composer. Locally as part of
your project, or globally as a system wide executable.
if you wanna do composer -- or laravel -- in command line, you wanna install them globally.
Check out the following links:
https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx
https://laravel.com/docs/4.2#install-laravel
I encountered the same problem. Apparently, the composer exists in path ~/.config/composer/vendor/bin when running as super user. Therefore, replacing the paths which were described above by this, and it should work. Hope it helps.
I need to install CakePHP 3 in an old-fashioned upload-unzip-run way.
The archive I've downloaded from cakephp/cakephp/tags does not contain the default folders like webroot, Model etc., which means it's not complete.
The official documentation does not cover this. Here's a relevant Github issue I found, but the person ends up still using Composer.
There's also cakephp/app and it seems to include those missing files, but it's not mentioned in cakephp/cakephp's composer.json, and even if I download it I've no idea how to merge the packages.
Packaged app (cakephp/app) releases that include all dependencies (framework (cakephp/cakephp), standard CakePHP plugins (cakephp/debugkit, cakephp/bake, etc), required third party libraries) can be found on GitHub.
https://github.com/cakephp/cakephp/releases
It's the download with the small package symbol, named like cake-3-x-x.zip.
However, it isn't a good idea to ditch the dependency manager, as keeping the code base and the autoloader up to date will be rather tedious, and, no offense, I have my doubts that you'll be able to handle this properly if you don't even know how to stitch the app and cake packages together.
You can install CakePhp 3 without Composer.
You need minimum requirements to install CakePhp 3 and CakePhp 3 boilerplate ( fresh copy of Cakephp 3 ).
You can download CakePhp 3 boilerplate from github.
Requirements
Server
HTTP Server. For example: Apache. Having mod_rewrite is preferred,but by no means required.
PHP 5.4.16 or greater.
mbstring extension
intl extension
Database :
MySQL (5.1.10 or greater)
PostgreSQL
Microsoft SQL Server (2008 or higher)
SQLite 3
All built-in drivers require PDO. You should make sure you have the correct PDO extensions installed.
CakePhp 3 Boilerplate:
Repository Home
https://github.com/cakephp/cakephp/releases
CakePhp 3.1.4
https://github.com/cakephp/cakephp/releases/download/3.1.4/cakephp-3-1-4.zip
CakePhp 3.0.15
https://github.com/cakephp/cakephp/releases/download/3.0.15/cakephp-3-0-15.zip
Download one repository and unzip where you wanted to install it.
You may get one error like ( you may not get error if you are lucky!)
Fatal Error
Cake\Error\FatalErrorException
Error: Class 'Cake\Mailer\Email' not found
File D:\xampp\htdocs\practice\cakephp\cakephp-3-1-4\config\bootstrap.php
Line: 138
Then you have to comment two line in config/bootstrap.php
//Email::configTransport(Configure::consume('EmailTransport'));
//Email::config(Configure::consume('Email'));
And finally you got CakePhp 3 installed.
[I am also new in CakePhp 3.So Please inform me if there are any wrong in my given process.]
Thanks
Use Composer.
Install Composer locally, follow the Cake installation instructions, then upload the created folders to the target webhost.
Easy, For CakePHP 3.x you can just download the release you want from here
https://github.com/cakephp/cakephp/releases (eg. https://github.com/cakephp/cakephp/releases/tag/3.3.16).
For a complete installation select the first download link (.zip)
the other links are just for the src
Just run this command to get a clone of CakePHP 3.10.0
git clone -b 3.x git://github.com/cakephp/cakephp.git
Try simple steps
1. Download XAMPP Server.
2. Install XAMPP server.
3. Go to ..\xampp\php\php.ini and open.
4. Add this line (extension=php_intl.dll) or if exist uncomment.
5. Download Composer setup from https://github.com/composer/windows-setup/releases/
6. Install composer and give php.exe file in path
7. Open cmd and check now php version using command php -v. if its showing php version its means its working.
8. Now open cmd and cd on xampp\htdocs folder & run command composer create-project --prefer-dist cakephp/app app_name
9. Finished folder created in htdocs.