-2

I am developing a PHP-CPP extension with c++. My extension is working perfectly when i run it through the command line. But when i try to run it in browser then the browser shows the error that class or functions not declared there. Can anyone tell me how to run it in browser?

PHP file:

 <?php
   include 'main.cpp';
   ini_set('display_errors', 1);
   ini_set('display_startup_errors', 1);
   error_reporting(E_ALL);
   echo "Check string";
   $obj = new item();
   echo "string";
   $obj->DBconnect();
   echo "string";

 ?>

Please see the picture Picture will provide the better idea

5
  • you need to post your code, question's unclear. Commented Apr 21, 2017 at 11:59
  • There is no need of code. I mentioned that code is running perfectly in cmd. But now i need to run my php file in browser and its showing error in the browser. Still i am going to post the php file code. Can't post the c++ code because its too much lengthy Commented Apr 21, 2017 at 12:08
  • you'll need to wait for someone else then. You tagged as php; so I for one and others probably are expecting the question to contain code, unless you honestly feel that that is irrelevant. In any case, you have now been given an answer below; see that. Commented Apr 21, 2017 at 12:09
  • use error reporting; see if that helps. Commented Apr 21, 2017 at 12:10
  • @Fred-ii- Thanx for your response. Iused the error reporting. According to which my my variables and object of class is not declare. But it runs pefectly in cmd. That's the main issue. Still i have added the php file. Commented Apr 21, 2017 at 12:13

1 Answer 1

0

It is possible that you have forget to edit the correct configuration file?

You wrote in CLI it isn't a problem. Maybe you have only append your extension in: /etc/php5/cli/php.ini

but maybe not in /etc/php5/apache2/php.ini

Sign up to request clarification or add additional context in comments.

3 Comments

I have nginx installed in machine not apache2. What i should do that in that case?
In this case you should edit the following file: /etc/php5/fpm/php.ini
What i should add in php.ini in the that path?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.