Hi there,
I am facing a quite annoying issue.
Situation
I would like to deploy symfony2 application in production on mutualized servers of OVH (pro). I got shell access (ssh), my database works fine and my files are online.
Issue
I cannot manage to make any php command line work. That is, for all major commandline:
- updating web directory : php app/console assets:install web
- updating databases: php app/console doctrine:schema:update --force
- downloading composer: php -r "eval('?>'.file_get_contents('http://getcomposer.org/installer'));"
-etc...
I get parse errors such as:
syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in
or
Error in argument 1, char 2: option not found r (that one was for composer download)
it seems a pretty common pb, however I couldn't manage to fix it :/
Any hints welcome!
Thanks in advance,
Cheers
On ovh, you can choose witch php is used by altering the cmd line :
/usr/local/bin/php.ORIG.5_4 -> php.ORIG.5.4.6
/usr/local/bin/php.ORIG.5_3 -> php.ORIG.5.3.16
/usr/local/bin/php.ORIG.5_2 -> php.ORIG.5.2.17
/usr/local/bin/php -> php.ORIG.4
I had a simular problem with deploying symfony2 project. I`m not sure that this is the case here, but my problem was with the cache. For some of the symfony2 console commands it uses cached paths, and if you have changed the location of the project this could cause the problem. It uses a cached path when trying to delete the cache :D so my suggestion is to go and delete manually the cache i app/cache.
Hope i helped
Related
I am trying to create a simple symfony project.
I run this on console:
composer create-project symfony/skeleton myProjectName
php -S 127.0.0.1:8000 -t myProjectName/public
Project succesfully run at localhost:8000. However, when I begin to inspect the code, I realized VS Code editor is indicating "Undefined type" error in projectDirectory/src/Kernel.php file. Do you have any ideas why this happens and any suggestions towards solution?
I use PHP v7.4.32 and Symfony 5.4 for development. My helper extentions are PHP Intelephense v1.8.2 and PHP IntelliSense v1.0.11.
projectDirectory/src/Kernel.php
The Error
Since it runs succesfully on browser, I dubted that the classes exist somewhere but the VSCode could not solve the relative paths. Then, I tried a couple of extensions. Installation of PHP v1.22.11089 created by DEVSENSE and PHP Namespace Resolver v1.1.9 created by Mehedi Hassan has solved the problem.
I need to upload my symfony 3 project online, but I have only access to ftp. So I did all necessary steps I found:
composer update
Clear the cache for production: php app/console cache:clear --env=prod
Upload all app folder on server
After I open my website I got the following error:
Fatal error: require(): Failed opening required
'/nfsmnt/hosting2_1/a/8/a87b3594-7cfe-459e-ad62-286d2dba2c54/zorbfutbal.sk/web/var..\vendor\symfony\symfony\src\Symfony\Component\ClassLoader\ApcClassLoader.php'
(include_path='.:/usr/php56/lib/php') in
/nfsmnt/hosting2_1/a/8/a87b3594-7cfe-459e-ad62-286d2dba2c54/zorbfutbal.sk/web/var/bootstrap.php.cache on line 1780
I checked the file and I have it there and also set all permissions.
What is confusing me is that path from error before my actual domain name.
"/nfsmnt/hosting2_1/a/8/a87b3594-7cfe-459e-ad62-286d2dba2c54/"
I dont know where it comed from and how to fix it.
Any idea? Thanks
You are absolutely sure you set the file permissions correctly like indicated here:
http://symfony.com/doc/current/setup/file_permissions.html#using-acl-on-a-system-that-supports-setfacl-linux-bsd
The message you posted seems to point to something like that.
Also run:
php bin/symfony_requirements
just to check that you've met all the other requirements.
I just pushed my L5.2 app to production server. I have made a few changes, but suddenly I get the following error:
PHP Fatal error: Declaration of Illuminate\Auth\SessionGuard::basic($field = 'email')
must be compatible with
Illuminate\Contracts\Auth\SupportsBasicAuth::basic($field = 'email', $extraConditions
= Array) in /home/forge/domain.com/bootstrap/cache/compiled.php on line 461
The app works fine locally and on the staging server.
just remove the bootstrap/cache/compiled.php file
rm bootstrap/cache/compiled.php
then run
composer dump-autoload
and
php artisan clear-compiled
it should work
I solved it.
I had to do:
rm bootstrap/compiled.php
I suppose that you have run composer update on production. You should copy composer.lock to production server (if you haven't done it yet) and run composer install to install exact same version you have on your localhost
You should also run php artisan clear-compiled because it might be also the problem.
Yes as other said, removing that file solves the error.
But in my case that file gets generated again and again automatically after 1 mins. (So to keep site running I need to manually delete that file over and over :) )
So here is what I did:
Opened that bootstrap/compiled.php, removed all the content and revoke write permission for that file.
And that worked very well for me.
I know its worst/temporary solution, but unless we know the exact cause of that issue and better solution, we can use this solution.
However I don't recommend anyone to use this solution for production sites, but you can use it for just a demo site like my case.
I just updated my project library folder (with an external to ZF svn) to ZF version 1.11. I'm now getting al kinds of weird errors, related to whitespaces, empty lines, etc. I searched on the internet for quite a while, but can't find a proper answer. I think this is related to some settings in my php.ini file but can't figure it out.
Example of an error:
Parse error: syntax error, unexpected $end in /library/Zend/Application.php on line 415 Call Stack: 0.0042 657160 1. {main}() /mnt/hgfs/htdocs/service/public/index.php:0
PHP version: PHP 5.3.5-0.dotdeb.1
All help would appreciated, I can't wrap my head around it!
I see you're running the project on a hgfs mount, probably inside your VM. Try to run your project off the hgfs mount as I found it to be buggy when dealing with these things.
For one, the default mount options don't keep into account that your file and directory properties (uid and gid) probably aren't the same on your guest and host system. Unfortunately, setting these right didn't fix it for me.
The solution I eventually used was to ditch the hgfs driver and mount the files using sshfs. On Debian you can just install it by running apt-get install sshfs. I then added an entry to /etc/fstab, like this:
sshfs#user#host:/path/to/host/dir /mnt/share fuse comment=sshfs,user,rw,exec,uid=1000,gid=1000,allow_other 0 0
Mounting the share can then be done by running this:
mount /mnt/share
Hope this helps!
I'm new to symfony and I am trying to run a simple command on the command line but I get an error message.
When I try to execute the command:
d:\new_xam\xampp\htdocs\sf_sandbox_1_2\sf_sandbox>symfony propel:build-model "
I get the error:
'php.exe' is not recognized as an
internal or external command,operable
program or batch file.
Can anybody help me?
This is a fairly common issue on Windows systems for people new to Symfony and/or PHP. It seems to be an issue with the PHP path. See here: http://forum.symfony-project.org/index.php/m/44895/?srch=php.exe+command#msg_44895
Can you try to use the real path for PHP?
i.e.,
"C:\Program Files\PHP\PHP.exe" symfony propel:build-model
At your Symfony directory.
You should be able to prefix everything with "php".
So instead of symfony propel:build-model you can do php symfony propel:build-model.