Change CLI's php - symfony

Im working with Symfony2. Im trying to execute the following command:
php app/console doctrine:database:create
The problem is that I get the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/opt/local/lib/php/extensions/no-debug-non-zts-20090626/apc.so' - dlopen(/opt/local/lib/php/extensions/no-debug-non-zts-20090626/apc.so, 9): image not found in Unknown on line 0
Could not create database for connection named <comment>symfony</comment>
could not find driver
APC is already installed, since the Symfony/web/config.php was OK, what I realised is that the version of php from CLI is different from the one Apache is running.
The one Apache is running has APC installed, so I would like CLI to run that same php, How can I do that?

in my case deleting the version that macports installed was enough to have CLI and Apache run the same PHP.
And that's:
sudo port uninstall php5

Related

Error Installing Silverstripe 4.0.1

Trying a fresh install of Silverstripe 4.0.1 but only gets this far -
Installing SilverStripe...
I am now running through the installation steps (this should take about 30 seconds)
If you receive a fatal error, refresh this page to continue the installation
Setting up /var/www/duonsdev/public_html/index.php
Setting up /var/www/duonsdev/public_html/mysite/_config.php
Setting up /var/www/duonsdev/public_html/mysite/_config/theme.yml
Setting up /var/www/duonsdev/public_html/.env
Setting up /var/www/duonsdev/public_html/.htaccess
Building database schema...
ERROR [Emergency]: Uncaught TypeError: Return value of Symfony\Component\Filesystem\Filesystem::toIterable() must be an instance of Symfony\Component\Filesystem\iterable, array returned IN POST /install.php Line 729 in /var/www/duonsdev/public_html/vendor/symfony/filesystem/Filesystem.php Source ====== 720: } 721: 722
And the error goes on and on. I tried refresh, but same error.
If I try a dev/build instead then it always dies at the point of -
Index File_Versions.OwnerID: created as index ("OwnerID")
Website Error
There has been an error
The website server has not been able to respond to your request
Trying to setup on Ubuntu 16 on local dev machine running Apache virtual host.
Never had this problem before and setup fine with ss4.0.
Any ideas?
I ran into the same issue, and after checking in the official SilverStripe Community's slack channel, they mentioned this is because I was not running PHP 7.1.
Apparently, the official SilverStripe tarball offered in their website was built with PHP 7.1, so Composer added newer Symfony dependencies. They mentioned this would be fixed in newer releases.
Therefore, there are 2 ways you can fix this issue:
Download SilverStripe with Composer:
$ curl -sS https://getcomposer.org/installer | php
$ ./composer.phar create-project silverstripe/installer /var/www/duonsdev/public_html/
Update your PHP version to 7.1.
After doing any of those steps, you will be able to access the web wizard for installing SilverStripe.
NOTE: If you're on a shared hosting, you will need to download SilverStripe on your local machine (ensuring the PHP version matches, at least in the major version, e.g. 7.0), and upload the files that were generated to your public_html directory.
Make sure the module php version of apache in the same version as the cli php version.
Looks like the error was to do with the php version.
I was installing silverstripe through the cli using composer, but running a different version of php in apache.
So in the cli the php version was php 7.1
But in apache the php version was php 7.0.
After changing the apache php to match the cli (because silverstripe was installed using composer in the cli) it worked!

Launch project symfony in browser [duplicate]

I have installed Lampp on my linux system, and I am learning symfony2, while trying to create the schema with symfony2 command
php app/console doctrine:schema:create
I am getting the following error message:-
PDOException “could not find driver”
I also uncomment this line extension=php_pdo_mysql.dll in php.ini file
I tried to look and google my issue but couldn't resolve my problem. when i run php -m command i am getting the following result:-
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/mysql.so' - /usr/lib/php5/20090626+lfs/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/mysqli.so' - /usr/lib/php5/20090626+lfs/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/pdo_mysql.so' - /usr/lib/php5/20090626+lfs/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mbstring
mhash
openssl
pcntl
pcre
PDO
----
----
Is there a way i can remove this issue ?
In Ubuntu, write in the console
sudo apt-get install php5-gd php5-mysql
and it will work
Hope you are running your project in localhost. In your project folder app/config a file named parameters.ini , Make sure that your Mysql database connection cofiguration is correct. If you are using mysql See database_driver=pdo_mysql is its driver.
Below is an example.
database_driver = pdo_mysql
database_host = localhost
database_port =
database_name = databasename
database_user = msqlusername
database_password = mysqlpassword//if not make blank
mailer_transport = smtp
mailer_host = localhost
mailer_user =
mailer_password =
locale = en
secret = ThisTokenIsNotSoSecretChangeIt
Hope it helps you.
You need to have a module called pdo_mysql.
Look for the following in phpinfo() output,
pdo_mysql => PDO Driver for MySQL, client library version => 5.1.44
to install pdo_mysql you need to do this:
pecl install pdo
pecl install pdo_mysql
and then add the following to your php.ini file:
extension=pdo.so
extension=pdo_mysql.so
brew install php70-pdo-pgsql
in case you installed php7 on mac with brew and, change php version according to what you have installed.
if you are using XAMPP then in php.ini file line no 897(depends on version),
;extension=php_pdo_pgsql.dll
uncomment it , then it appears like below
extension=php_pdo_pgsql.dll
in php.ini file line no 897, then restart XAMPP.
There are two PHP versions installed in my server PHP 5.6 and PHP 7
When I run the command php app/console doctrine:schema:update I have the error : [PDOException] could not find driver
I resolve this error by specifying the PHP version:
php5.6 app/console doctrine:schema:update
Looks like your install is missing the .so files it needs to implement the mysql connection. If you're using a package management system to install PHP then make sure you've installed all the necessary submodules (in this case I think you'll need mysql-dev, and the various PHP PDO modules), though such dependencies should have been resolved for you by the package manager.
If you didn't go through a package manager, then you'll have to compile the required .so files from source.
I had the same problem and for me, it was having multiple PHP versions.
So specifying the full address of the PHP solved the problem.
Adding to Jaspreet Chahal's answer.
When installing PDO as a shared module, the php.ini file needs to be updated so that the PDO extension will be loaded automatically when PHP runs. You will also need to enable any database specific drivers there too; make sure that they are listed after the pdo.so line, as PDO must be initialized before the database-specific extensions can be loaded. If you built PDO and the database-specific extensions statically, you can skip this step(Source).
What I mean is, it should look something like this -
extension=pdo.so should be placed before the extensions of the different database drivers.
Maybe you forget to install doctrine/dbal
composer update
composer require doctrine/dbal
if it didn't work go to your php.ini (according to current version)
and remove ";"
;extension=pdo_mysql.so

Drupal 8 Composer Your requirements could not be resolved to an installable set of packages - commerceguys/intl

I want to install it.
drupal.org/project/social
But also ssh I get an error.
I installed Composer and Drush.
composer-creator of the project goalgorill / social_templat to: giant-master Dr --no-interaction
I get an error in the command enters the picture.
Composer is telling you exactly what is wrong:
the requested PHP extension bcmath is missing from your system
and how to fix it:
To enable extensions, verify that they are enabled in those ini files
Install and enable the bcmath extension. The exact process will depend on your operating system and how you installed PHP.

How to install symfony2 project existing in github repository to local instance

I'm having a symfony2 project in github repository. I want to install it to my local instance. I'm using Xampp on Windows 7. How can I achieve it?
Thanks!!
if your using xampp the easiest way is to use symfony build in server.
clone or download the symfony project to your xampp htdocs.
start your xampp and open the shell, (shell button on the right)
locate yourself in the root symfony dir. and type:
php app/console server:run
a local php server should start on http://localhost:8000
i recomment using this because (dev mode is loaded by default).
its faster then a VM because you dont sync files.
you can also add verbose arguments
php app/console server:run -vvv
that way you get more output info when debugging.

Install Fixtures in Sylius - Symfony2

After having successfully installed and updated all vendors in my project folder for Sylius i tried running this code :
app/console sylius:install --fixtures
I get this error :
PHP Fatal error: Class 'ResourceBundle' not found in C:\wamp\www\sylius\vendor\
symfony\symfony\src\Symfony\Component\Locale\Locale.php on line 51
Then i tried all possible solutions given here
Installed intl extension in php (working successfully).Then ran this command
php build-data.php 'your ICU version'
On running the above command i get this:
'which' is not recognized as an internal or external command,
operable program or batch file.
The command "svn" is not installed
I want to know if there is another workaround to this issue.
Please help and thanks in advance.
P.S. - No SVN runs on my system. And i'm using icu*46.dll
Anyone came across this??
This error relates to be PHP intl-extension. Make sure it is enabled and you have the LATEST version.
quick test:
<?php
var_dump(extension_loaded('intl'));
Make sure your PHP folder is correctly registered in your %PATH% environment variable.
Control Panel - System - Advanced - ...
Without that, the ICU dlls are not loaded by PHP as Apache module - no error message is displayed, but the extension is not enabled.
Check aswell from phpinfo() ! not with ...
php -m
... or ( windows = findstr, linux/cygwin = grep )
php -i | findstr intl
check that the extension is enabled in your php.ini ( dont know WAMP's extenion path so adjust it please )
extension=php_intl.dll
As i can see you are on Windows and using WAMP you will have to get a precompiled version of the extension.
The packages on http://windows.php.net/download/ all contain the php_intl.dll in the ext folder.
Make sure that the ICU is compiled with the same version of MSVC that PHP is.
You run into problems if the ICU was compiled with VC10 and PHP was with VC9.
Although php -m and php -i detect the INTL it wouldn't show up in phpinfo().

Resources