-1

I am working on a Symfony 2 website, and having an issue only in production (cache is clear).

I am using the Payplug php api : I' ve put the files in the vendor folder, I use the namespace for the classes I use, and everything is ok on my local dev environment.

Once on the prod server, I get the error:

"Attempted to load class "Payplug" from namespace "Payplug". Did you forget a "use" statement for another namespace?"

I don't get why it gets a namespace error only on the prod server...

CONTROLLER :

<?php

    namespace KpmBundle\Controller;

    use KpmBundle\Entity\Marche;
    use KpmBundle\Entity\Marcheur;
    use KpmBundle\Entity\Commande;
    use Symfony\Bundle\FrameworkBundle\Controller\Controller;
    use Symfony\Component\HttpFoundation\Request;
    use Payplug\Payplug as Payplug;
    use Payplug\Payment as Payment;

    class MarcheController extends Controller
    {
        //code

        Payplug::setSecretKey(...);

        //more code
    }

CLASS

<?php
    namespace Payplug;

    /**
     * The Payment DAO simplifies the access to most useful methods
     **/
    class Payment
    {

I really wonder why everything works fine on my local dev server ( app_dev.php and app.php ), but goes wrong on prod server...

Any idea would be appreciated,

regards

EDIT The files where installed via composer

singe batteur
  • 401
  • 2
  • 14
  • I suppose you could try a "composer dumpautoload" on your production server but, from what you described, it probably won't help. – Cerad Jun 13 '18 at 14:07
  • unhapily I have no ssh access, only ftp transfer... what file could be modified ? – singe batteur Jun 13 '18 at 14:12
  • 1
    When you did the transfer, did you transfer the entire vendor directory or just the payplug stuff? You need to make sure that all the stuff under vendor/composer is in sync between production and development. – Cerad Jun 13 '18 at 14:18
  • I pushed the payplug stuff alone, and I see different sizes on the files under vendor/composer... you might have solved my problem ! – singe batteur Jun 13 '18 at 14:22
  • @cerad Good job, my vendor/composer wasnt sync with the dev one. Thx – singe batteur Jun 13 '18 at 14:24

1 Answers1

0

I was using FTP, and transfered the vendor\payplug directory alone to the remote server ; as a result the vendor\composer wasn't sync between local and remote server. transfering the local vendor\composer solved the problem

Thx to @cerad

singe batteur
  • 401
  • 2
  • 14