Class not found - PHP server config? - php

So I'm working from a laptop, and I'm developing a PHP application. Being allowed to work from home, I installed EasyPHP on the laptop so I can host the web application locally on the laptop and work even when not connected to the internet, and without the use for a VPN connection, and even for when I'm at work, no need to mess with FileZilla or whatever, everthing will be so much easier like that for me.
My problem is the following: from our dev server, at work, everything is good. I copied the whole code in my easyphp folder, and I make a duplicate of my database in my local MySQL server. Running the application on my work's dev server, everything is fine. But locally, I get the following error:
Fatal error: Class 'ConfigNamespace' not found in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\MyApplication\libs\config\ConfigParser.php on line 50
So my ConfigParser class calls a New ConfigNamespace() at line 50... The local server doesn't like it. The ConfigNamespace class sits next to the ConfigParser class, in the \libs\config folder. Why does t not work locally, but works on the dev server?
I am under the impression that the configuration of the servers are different, and that my local server decides to expect all the classes to be in the root folder... but it's not!
I've searched on the web but only found things regarding system classes being unreachable... nothing that really has anything to do with my problem.
Thanks,

I fixed it. It ended up being a problem with rights on the folders after all. I did give it all the rights, but windows somehow still blocked it... I changed my document root for another folder, not in program files, and now everything works!

Related

Failed to open Stream, no such file or directory

I recently started using the Laravel framework and i set up a little workspace for me to work in. I setup a Xubuntu client at home that runs a Apache server from which i program and host my Laravel instance from. Now recently I've run into a little bit of a problem. I was following a tutorial series and everything went fine, the next day however i run into this error http://puu.sh/nh5vQ/8ae11c52ab.png
Both from opening the /var/www/html/test/public directory in apache2 from my webbrowser or from running php artisan and actually hosting the laravel instance.
So the first thing that came to mind was permissions, but the permissions for the public folder are fine, It should be able to read or execute as any program. http://puu.sh/nh5Ho/06e061a056.png
Mostly other posts can reference to a bit of code where they specified the wrong filepath. What i find odd is that when i open my hosted instance of apache server in my webbrowser, where you can technically browse all the files in the hosted directory it is there in the list, but when i click it it pops up with that same error.
I checked if all the files that the server is trying to acces exist, and they do exist and i made no typo's.
I'm going to continue on looking and i shall post the solution as soon as i find one, though I'm hoping you guys have an idea since I've been looking for about 2 days to find a solution.
Thanks for your time
I Decided I'd have to start a new Laravel project to fix this without making a chaoticly configured project.

Laravel / Nginx serving wrong site

I have tried everything.
I recently tried to deploy a new Laravel application on my Ubuntu Digital Ocean droplet. I have done this many times in the past and have done nothing out of the ordinary with this project. I'm using https://gist.github.com/jamieshepherd/50419bb148a4f43e8266 this as a template nginx configuration, which I base all of my sites off. However, this time I deployed and went to my domain, I was served another client's site. The site had no images, styles, scripts etc. - but sure enough this was the wrong site. Weirdly, I could go to /images/example.jpg and get the correct file which would be in /public/images/example.jpg - but the actual routes were being served from a completely different folder.
There is absolutely no reference to the other client in my project anywhere, I feel like it has something to do with Laravel or PHP5-FPM setting some kind of root directory to the other folder.
I have gone to /public/index.php and just echo and died a message, and this works fine. When I revert the change and let the application run it again displays the other client's application. Here's a list of other things I've tried.
Temporarily renaming the other client's folder, as expected, NewSite throws a 404 error
Temporarily disabling the other client's nginx block, NewSite continues to serve the other client's site (remember, not css/images/scripts, weirdly)
Reinstalling PHP5-FPM
Printing the document_root, everything looks normal (/web/NewSite/public)
Trying to run the site off a different port
Pulled a working Laravel application from a completely different server, put it on this server, set the domain to point to this working application, serves the other client's site
Grep'd for any references to the client site in any of the project folders just to check I wasn't going insane, confirmed I'm not insane, though after all this I'm not sure anymore
Really I'm lost, I have no idea how to debug this any more.
Site trying to deploy: http://paragon.gg
Client site view that it's servring: https://swellhunter.co.uk
Client site NGINX conf: https://gist.github.com/jamieshepherd/4ff5430ddb13ed04f22c
Edit: Update: To make matters even more bizarre. I have temporarily removed swellhunter from sites-enabled, visited paragon.gg, still serves swellhunter's index. WHAT? There is absolutely no reference to the site at all now, I've even moved the paragongg folder to a completely different place to check. How on earth is it even finding the view with no reference to go on?
Seems like an issue with Laravel rather than with nginx or with your VPS.
Since you pointed out simple PHP file is pointing out rightly.
SSH to your droplet and run you laravel app using php artisan serve.
And access your droplet on port:3000
If the problem persists you can rule out server issues and can concentrate on debugging laravel app. Maybe be there is something wrong with you laravel app itself, some unwanted changes etc. Did you verify your laravel App?
Can you paste an LS -l of the directory? Have you checked to see what you have in the Laravel app/config/app.php for url ? I just took a look at paragon.gg and put https://paragon.gg it gave me a cert error but after I accepted it the site looked fine. Is that not the result you wanted?

Connection to database when changing from online to local server (wordpress)

I'm starting to get crazy with this.
I have to do some modifications to a wordpress website that i didn't create. I have access to the hosting so I downloaded all the files and a copy of the database.
After creating and importing in the local database I went to wp-config.php and change the hosting parametres (user, pass, server,...) for the local ones.
But here comes the troubles. When I change the online server dbXXXX.db.1and1.com to localhost it suddenly stops working and files called index.php won't ever work again
(I get "localhost server not found" error),
even if I change the source folder, or restart MAMP or restart the laptop... The only solution is to unistall MAMP, restart the system and install it again, but when changing the name of the server to localhost it happens again...
Well... If I copy the content of index.php in another file (for example index2.php) and set the parameters to the online server it works again until I change server to localhost.
When I say "it works" means that at least I get "error database connection" from wordpress (due to the online hosting does not allow external requests to its databases).
Can somebody help? Do you need some extra information? Thanks!
MAMP did some crazy this on my PC to, so I decided to switch to WAMP -
http://www.wampserver.com/en/
You may give it a try ?!
Finally I found the error. It's due to the file ".htaccess" that Wordpress (or I don't know who) creates for using permalink and MAC OS X.
When unzipping the web downloaded from the hosting the OS deleted that file because only system files can start with a dot (".htaccess").
I didn't find the solution and just start to work in Windows with BootCamp and all was fine. I was in a hurry to finish this job so I didn't have more time to try new solutions.
So I have not the solution but the source of the problem. Hope this helps someone at least finding the problem and save some time.

Tiny PHP Script runs fine on dev server, fails on hosted server

Im pretty new to php, Ive got a linux server running php 5.5.9 , and all I want it to do is take whatever is sent to it in an http post, and dump it to a file.
Currently the code I have is this
<?php
file_put_contents("outputfile.txt", file_get_contents('php://input'));
It works 100%, does exactly what I want when its on my own server.
When I upload it to my web server (HostGator) it gets a 500 error. The web server is running php 5.4, Im not sure if thats the issue.
Basically what Im trying to learn is why doesnt this work, and how do I fix it, its a pretty simple script.
John and Louis pointed me to the right answer, it was entirely the permissions on the folder the files were in. The folder was 777 for some reason, and switching it to 755 like the files were fixed it.
I had no idea that could even cause a 500 error

Mediawiki engine only works on Lan, works intermittently externally

I have recently installed a LAMP server running ubuntu server 11.04. I am trying to run a private mediawiki engine online, version 1.17.0. For some odd reason it works perfectly on the LAN only, when I use an external network, it would continue load forever and proceed to being timed out. Other folders I have seemed to be doing fine externally so I believe my network configuration should be ok. Sometimes when I do get lucky (like 10% of the time), it will load normally for a few pages and resume once again to hanging. If I stop the page load it would appear but the skin would be missing.
I used firebug and found that 2 processes with something like load.php/debug=false....style:skin=vector that is hanging while all the other files load fine. If I stopped all the extensions, killed both common.js and common.css, and prevent the use of javascript on the site, it would work fine (relatively speaking, it would load everything quickly). I think it is a javascript problem but I am not sure where to look for an error log for java.
When checking the firefox error console I also noted the same error location had a "message: expected '}'". However, when running in the LAN it has the same message but it still works fine. I tried looking through all possible resources but to no avail.
Finally found the solution to this problem: it was a networking issue afterall. I checked all the logs and could not find anything. But found that the problem was that the ubuntu was running under a dchp setting so I changed it into a static ip mode and now it works perfectly. Althought I don't understand why it would make a difference between broadcasting via LAN only vs. external, it works perfectly now. Thanks to anyone who tried

Categories