I've installed restler using composer. I've set up a virtual host for it. I'm able to go to my localhost in my browser and it shows some informational pages but as soon as I try one of the APIs I get a server 500 error.
My PHP logs say:
Function main
Error Type E_ERROR
Source File /public/examples/_001_helloworld/index.php : 18
Error String Class 'Luracast\Restler\Restler' not found
I'm using the example code straight out of the project. It looks like it has the require_once '../../../vendor/restler.php' and it seems to still have 500 errors.
I'm using PHP 5.4.16 on a Mac.
Update
Here are all of my logs:
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: include(/Users/ChrisLondon/composer/autoload_classmap.php): failed to open stream: No such file or directory in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 432
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: include(): Failed opening '/Users/ChrisLondon/composer/autoload_classmap.php' for inclusion (include_path='.:/usr/local/zend/share/ZendFramework/library:/usr/local/zend/share/pear:/opt/local/lib/php') in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 432
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: include(/Users/ChrisLondon/composer/autoload_namespaces.php): failed to open stream: No such file or directory in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 432
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: include(): Failed opening '/Users/ChrisLondon/composer/autoload_namespaces.php' for inclusion (include_path='.:/usr/local/zend/share/ZendFramework/library:/usr/local/zend/share/pear:/opt/local/lib/php') in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 432
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_values() expects parameter 1 to be array, boolean given in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 154
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_merge(): Argument #2 is not an array in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 155
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_merge(): Argument #1 is not an array in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 155
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_map(): Argument #2 should be an array in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 166
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_filter() expects parameter 1 to be array, null given in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 166
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: natsort() expects parameter 1 to be array, null given in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 167
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_unique() expects parameter 1 to be array, null given in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 170
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: implode(): Invalid arguments passed in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 170
[05-Sep-2013 17:05:09 America/Denver] PHP Fatal error: Class 'Luracast\Restler\Restler' not found in /Users/ChrisLondon/personal/SuperfyMe/public/examples/_001_helloworld/index.php on line 19
It seems like it's trying to find the autoload class here: /Users/ChrisLondon/composer/autoload_classmap.php but the file is actually here: /Users/ChrisLondon/personal/SuperfyMe/vendor/composer/autoload_classmap.php
Solved my issue.
It turns out because I have a folder named composer/ that happens to be two folders up from where the Restler app sits it ruins the Restler autoloader. To solve the issue one needs to do one of the following:
1) Don't have any folder named composer/ two folders up from where the Restler app resides
2) Modify the Restler autoloader to skip the folder (at the time of this post you could comment out line 138 of /vendor/Luracast/Restler/Autoloader.php)
A more elegant solution has been proposed by me on GitHub:
Issue: https://github.com/Luracast/Restler/issues/195
Pull Request: https://github.com/Luracast/Restler/pull/196
By the time someone else finds this post hopefully the issue will be resolved in future versions of Restler.
Related
[20-Feb-2015 17:45:02 Europe/Berlin] PHP Fatal error: Class 'Varien_Autoload' not found in /home/vzvutpbd/public_html/app/Mage.php on line 53
[20-Feb-2015 17:46:32 Europe/Berlin] PHP Warning: include_once(Mage/Core/functions.php): failed to open stream: No such file or directory in /home/vzvutpbd/public_html/app/Mage.php on line 49
[20-Feb-2015 17:46:32 Europe/Berlin] PHP Warning: include_once(): Failed opening 'Mage/Core/functions.php' for inclusion (include_path='.:/usr/php4/lib/php:/usr/local/php4/lib/php:/usr/lib/php:/usr/local/lib/php:/home/vzvutpbd/php') in /home/vzvutpbd/public_html/app/Mage.php on line 49
Ensure that all files listed are there & have appropriate read permissions.
Magento - Wiki - Resetting File Permissions
This should resolve your issues, granted the files are indeed there.
[31-Oct-2014 12:47:24 UTC] PHP Warning: include_once(../connect/con.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in /home/denzw681/public_html/u/userPages/check_login_status.php on line 3
[31-Oct-2014 12:47:24 UTC] PHP Warning: include_once() [<a href='function.include'>function.include</a>]: Failed opening '../connect/con.php' for inclusion (include_path='.:/opt/alt/php53/usr/share/pear:/opt/alt/php53/usr/share/php') in /home/denzw681/public_html/u/userPages/check_login_status.php on line 3
[31-Oct-2014 12:47:24 UTC] PHP Notice: Undefined variable: con in /home/denzw681/public_html/u/userPages/check_login_status.php on line 26
[31-Oct-2014 12:47:24 UTC] PHP Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /home/denzw681/public_html/u/userPages/check_login_status.php on line 15
[31-Oct-2014 12:47:24 UTC] PHP Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in /home/denzw681/public_html/u/userPages/check_login_status.php on line 16
I have folders this way:
>> public_html/u/connect/con.php
>> public_html/u/userPages/check_login_status.php
>> public_html/u/userPages/php_parsers/photo_system.php
Not sure how to sulve this issue (
I can add the files code if needed to answer this question.
P.S. website is http://www.U.example.com/
You can try using the root of your site, with:
include_once($_SERVER['DOCUMENT_ROOT']."/u/connect/con.php");
Or you can use the magic constant:
define( 'ROOT_PATH', dirname( dirname( __FILE__ ) ) );
Source: PHP - Document_Root vs Sub-Domains
you to give correct path of connection Try
include_once('../../connect/con.php');
or would be better if define your site url in common file like header.php
define('SITEURL', 'http://example.com/u/');
and use this to include files
include_once(SITEURL.'connect/con.php');
I want to install Joomla on my website but I get these errors , what to do please?
Deprecated: Assigning the return value of new by reference is deprecated in /home/u806493334/public_html/includes/joomla.php on line 844
Warning: require_once(): open_basedir restriction in effect. File(/home/minhdiep/public_html/v1/includes/version.php) is not within the allowed path(s): (/home/u806493334:/usr/lib/php:/tmp) in /home/u806493334/public_html/includes/joomla.php on line 71
Warning: require_once(/home/minhdiep/public_html/v1/includes/version.php): failed to open stream: Operation not permitted in /home/u806493334/public_html/includes/joomla.php on line 71
Fatal error: require_once(): Failed opening required '/home/minhdiep/public_html/v1/includes/version.php' (include_path='.:/usr/lib/php') in /home/u806493334/public_html/includes/joomla.php on line 71
It appears that you've got to make some changes to your PHP.ini file. Have a look at the docs at open_basedir.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Zend - cannot find PHPUnit/framework.php
I'm getting some strange warnings and errors, and I don't know why, maybe you had this problem too and found a solution.
I'm testing a model
class UsersTest extends PHPUNit_Framework_TestCase {
public function testCanCheckUser(){
$user = Users::getInstance();
$userNotFound = true;
$this->assertFalse($userNotFound);
} }
So here is the error that I'm getting:
PHP Strict Standards: Creating default object from empty value in C:\Users\Lili
\Dropbox\www\_playground\myApp\application\Bootstrap.php on line 207
PHPUnit 3.7.9 by Sebastian Bergmann.
Configuration read from C:\Users\Lili\Dropbox\www\_playground\myApp\tests\phpuni
t.xml
←[41;37mF←[0m
Time: 0 seconds, Memory: 5.50Mb
There was 1 failure:
1) UsersTest::testCanCheckUser
PHP Warning: include_once(PHP\Invoker.php): failed to open stream: No such file
or directory in C:\Users\Lili\Dropbox\www\_playground\myApp\Zend\Loader.php on
line 146
PHP Warning: include_once(): Failed opening 'PHP\Invoker.php' for inclusion (in
clude_path='C:\xampp\php\PEAR\PHPUnit;C:\Users\Lili\Dropbox\www\_playground\opun
y\application/../library;C:\Users\Lili\Dropbox\www\_playground\myApp\application
;C:\Users\Lili\Dropbox\www\_playground\myApp\application/models;C:\Users\Lili\Dr
opbox\www\_playground\myApp\application/../;.;C:\xampp\php\PEAR') in C:\Users\Li
li\Dropbox\www\_playground\myApp\Zend\Loader.php on line 146
PHP Warning: include_once(PHPUnit\Extensions\SeleniumTestCase.php): failed to o
pen stream: No such file or directory in C:\Users\Lili\Dropbox\www\_playground\o
puny\Zend\Loader.php on line 146
PHP Warning: include_once(): Failed opening 'PHPUnit\Extensions\SeleniumTestCas
e.php' for inclusion (include_path='C:\xampp\php\PEAR\PHPUnit;C:\Users\Lili\Drop
box\www\_playground\myApp\application/../library;C:\Users\Lili\Dropbox\www\_play
ground\myApp\application;C:\Users\Lili\Dropbox\www\_playground\myApp\application
/models;C:\Users\Lili\Dropbox\www\_playground\myApp\application/../;.;C:\xampp\p
hp\PEAR') in C:\Users\Lili\Dropbox\www\_playground\myApp\Zend\Loader.php on line
146
PHP Warning: include_once(PHPUnit\Extensions\Story\TestCase.php): failed to ope
n stream: No such file or directory in C:\Users\Lili\Dropbox\www\_playground\opu
ny\Zend\Loader.php on line 146
PHP Warning: include_once(): Failed opening 'PHPUnit\Extensions\Story\TestCase.
php' for inclusion (include_path='C:\xampp\php\PEAR\PHPUnit;C:\Users\Lili\Dropbo
x\www\_playground\myApp\application/../library;C:\Users\Lili\Dropbox\www\_playgr
ound\myApp\application;C:\Users\Lili\Dropbox\www\_playground\myApp\application/m
odels;C:\Users\Lili\Dropbox\www\_playground\myApp\application/../;.;C:\xampp\php
\PEAR') in C:\Users\Lili\Dropbox\www\_playground\myApp\Zend\Loader.php on line 1
46
Failed asserting that true is false.
C:\Users\Lili\Dropbox\www\_playground\myApp\tests\application\models\UsersTest.p
hp:13
←[37;41m←[2KFAILURES!
←[0m←[37;41m←[2KTests: 1, Assertions: 1, Failures: 1.
←[0m←[2K
Here is the solution: Zend - cannot find PHPUnit/framework.php
Or Just copy/paste the files required by the warnings and it will do the job
all goes well suddenly i dont know why a fatal error occurred can any one please tell me the solution ???
Warning: include(lang.php) [function.include]: failed to open stream: Operation not permitted in /var/httpdocs/dev52/include.php on line 59
Warning: include() [function.include]: Failed opening 'lang.php' for inclusion (include_path='.:') in /var/httpdocs/dev52/include.php on line 59
Warning: include(lang2.php) [function.include]: failed to open stream: Operation not permitted in /var/httpdocs/dev52/include.php on line 61
Warning: include() [function.include]: Failed opening 'lang2.php' for inclusion (include_path='.:') in /var/httpdocs/dev52/include.php on line 61
Warning: include_once(inc.php) [function.include-once]: failed to open stream: Operation not permitted in /var/httpdocs/dev52/include.php on line 265
Warning: include_once() [function.include]: Failed opening 'inc.php' for inclusion (include_path='.:') in /var/httpdocs/dev52/include.php on line 265
Fatal error: Call to undefined function geoip_open() in /var/httpdocs/dev52/include.php on line 266
I would suggest you contact your webhost. If everything was working and it suddenly stops working, especially on a widely-used package like phpMyAdmin, it's more than likely someone changed a configuration setting and screwed it up.
If this doesn't help, or if you own the server yourself, try reinstalling phpMyAdmin.
This sometimes happens with nested includes, check to see if there are any include(); statements in lang.php and if so then include these files directly.