Symfony 1.4 installation and security issues - php

I have a shared hosting account in which I want to install my symfony 1.4 and deploy and application. I bumped into some issues because of the inability to change the apache config on the production server.
the structure of my web server is:
hosting_account_name
html <--- public folder
I then moved all files in symfony local app folder to my hosting_account_name and put the web folder content in html
So i got the following structure:
hosting_account_name
apps
cache
config
data
html
css
js
index.php
.htaccess
frontend_dev.php
lib
log
plugins
test
and i added the line bellow to config/ProjectConfiguration.class.php
$this->setWebDir($this->getRootDir().'/www');
I have a couple of issues though:
1. when i access the frontend_dev.php no images are due to the fact that symfony expects some files to be under a sf/ folder. Should I move the files there?
2. Index.php gives an error. Even with display errors set to yes and 500 internal server error is presented.
Also i had to set my permissions to 777 on cache and log. Their are under the folder html so that's ok for security right?

First, you said that the "public" folder is html, but you used $this->setWebDir($this->getRootDir().'/www');. Is it html or www? (Just to make sure)
Then: setting the sf_web_dir should work like you expected, so that shouldn't throw any errors.
To link the /sf Symfony folder, you will need to add something to your apache configuration. As described on the first page of the Jobeet tutorial, you will need to add an Alias to the /lib/vendor/symfony/data/web/sf.
If you don't have access to the httpd.conf, you could also add this to your .htaccess.
777 for log and cache is ok. It's what the default project:permissions task does as well.

Related

NotFoundHttpException Only for the CSS and JS files

So for context, the application is a portal for my company that we have hosted on the main production server. Then we have the developer version on a different server. Same exact application but on a different VM and has a different url. That was all set up before I got put in charge of it. Now we want to make an alpha server as the dev server can affect the main database. So for the alpha we need to pretty much have it be exactly like dev, but once it's built, copy the database to a separate db and disconnect it from the main one.
But right now the issue is setting it up. I got Apache2 setup and the site all put together. Now the issue I'm running into is that it's showing the site but not running any of the CSS or JS. The laravel log shows this:
[2019-02-20 11:33:51] local.ERROR: User: test Route:
https://test/app/portal/final.css File:
/var/www/laravel/bootstrap/cache/compiled.php Line: 8335
Class:
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
Exception: exception
'Symfony\Component\HttpKernel\Exception\NotFoundHttpException' in
/var/www/laravel/bootstrap/cache/compiled.php:8335
The same error comes up for the js file but I don't want to post that as it is the exact same error.
And the output of my site right now is just a bunch of links and text in a left tabbed column on the left.
I assume this is due to something not being installed or a config file not reading properly. The code for the site is all just git fetched so it's exactly the same as from the other two servers. The only difference is packages installed into the actual server. It seems that the css and js files aren't loading for some reason. I tried a bunch of other threads and fixes with no luck.
PHP Version is PHP 5.6.40-1+ubuntu18.04.1+deb.sury.org+1 (cli)
Apache2 for the server.
Composer version 1.5.6
Laravel 5
Thank you for any help.
Apache Config: https://drive.google.com/open?id=1im9voo0xqlyuf48gX-JJsRu00f0ym1UX
The CSS and JS files are in the public folder under css and js folders respectively.
Like I said, everything works just fine on the two servers already in place and the filesystem and code is the exact same at this point. The only thing that can be different is apache, laravel, and php.
Are you using Laravel mix with version ? If so, you need to import the css like :
<link rel="stylesheet" src="{{mix('final.css')}}">
or use the asset function just to be safe for any CSS/JS you need to import.
Three possibilities...
Apache root folder
First, the document root in your apache config (or site-enabled) needs to be the /public folder. In which case your request wouldn't hit the .htaccess and redirect to index.php and you'd get a bad route error. So this is a less likely option.
Compile Your .css and .js
You haven't compiled the .css and .js using Webpack (or gulp or whatever if you don't webpack) on the new server. In this case, the .htacess would send the request to index.php and Laravel would look for a route (which is what your error looks like) and then you'd get an error about an invalid route. Note the .css and .js should be in the .gitignore if you use git to clone the project, making this an easy thing to overlook and to have happen. Nice thing is that if node and npm are setup and you use webpack, it should just be a:
npm run development
The sad thing is getting node and npm and webpack all working isn't always as simple as it should because of versions and such.
Missing or not reading the .htaccess
Finally, your .htaccess isn't being read or didn't get copied over, which would mean that that / route would magically work, but any other routes wouldn't... Though, in that case your .css and .js should still work -- but not likely.

How to move Joomla 1.5?

I've read a lot on the internet about how to move Joomla. So, confident in myself, I've moved this old joomla 1.5 website to another machine.
I've copied files and database (data and user) as it were in the old machine on the new. Same folder name, same apache2 configuration, same .htaccess, same database configuration, name and data, same operative system, same php version...
Unfortunately, any page I'm trying to visit return a "404 component not found error" like it cannot find the page.
I cannot get what is happening. Mooving Joomla requires particular attentions, after copying files and database?
You have to change in configuration.php file the path of log and tmp directory, It's hard for you to have the same path in a different machine.
In the log file there are more details? Type what component.
Some things to check when a moved Joomla website is not working as expected:
the .htaccess file (in particular, check the RewriteBase /, Options +FollowSymLinks lines or any non-standard lines - compare with htaccess.txt for the default settings)
the configuration.php file, check tmp and logs paths are correct, try setting $live_site = ''; if it's not already
check for any php.ini files in the root folder and also in the /administrator folder - php.ini files are often not needed any more as you can configure PHP settings via cPanel or similar
try disabling URL Rewriting in Global Configuration

Internal pages not found (404) after moving to new host - CodeIgniter

I have recently moved one website to new server. I have transferred everything properly including mysql database. But now the internal pages are not opening (sending 404 error). Homepage looks fine.
One thing to consider here is that, the website was on shared cpanel with another domain and residing in a folder. Now after moving, it is placed directly in public_html. I hope, this doesn't create any issue.
The website is: http://nepaltrekking.co.kr/
regards,
When hosting changes, we need to take care of the following steps for codeigniter:
Check required php and apache modules are installed and enabled.
If installation is not in root directory, you must change htaccess.
If domain is changed, you need to edit config file for new base_url.
Clear application cache if enabled. Give required write permision in cache directory.
If nothing works, then see error log and correct error accordingly.
Actually I resolved it. The issue was with .htaccess. I changed the permission to 666 and it started working. I think there was problem writing in the .htaccess file.

Installing Silverstripe 3.1 on subdomain

First time asking a question here but I'm really stuck.
Basically I'm trying to install a Silverstripe 3.1 cms on a subdomain as a development site, on my main domain I already have a Silverstripe 2.4 site running.
The first thing that comes up is this error, "development" is the subdomain folder.
Warning: require_once(framework/dev/install/DatabaseConfigurationHelper.php): failed to open stream: No such file or directory in /home/usr/public_html/subdomain/framework/dev/install/install.php5 on line 39
I check if the file is there and it is, then I check if the filepath is wrong because the file that is calling require_once has a full path from home/ but that can't be it because I've been able to install Silverstripe on my localhost.
I google redirecting (I've had no experience with it before) and find stuff on htaccess related to Silverstripe but none were problems that I was having, i.e. there are .htaccess files in main directory and subdomain. Not too sure if they're conflicting but I have tried RewriteEngine Off on my subdomain. I mostly leave the default Silverstripe .htaccess files as they are.
Even declaring different suPHP_ConfigPath's i.e.
main website: home/usr/public_html/
subdomain: home/usr/public_html/subdomain
At this point I look back at the error and try hacking the require_once filepath, changing it to
$_SERVER["DOCUMENT_ROOT"] . '/framework/dev/install/DatabaseConfigurationHelper.php
It mostly works but the requirements check page is void of css and any fails to GET any images
I am able to check all the requirements though passing everything but the File Permissions check:
"Does the webserver know where files are stored?" failed. Showing me the filepath it tried being the absolute path of a file prepended with the path to the subdomain. Looking at the code my hack was never intended to work.
Did I miss something? I'm not very knowledgeable with servers but I've done everything I can think of, is there anything I can do?
Hey thanks for your suggestion but I think it was meant for addon domains? I only wanted a subdomain for testing purposes.
What I ended up doing was to avoid installing Silverstripe on the server and instead install it on my laptop and then upload that to the server. It worked fine after copying the appropriate database and fixing Silverstripe's BaseURL to '/'

Netbeans and codeigniter

For some reason when I create a project in netbeans and go to run the project it also loads the xxamp index file and not the project index file that is apart of the codeigniter installation.
http://screencast.com/t/qOSH80wPgvf
Edit:
Here is my file tree I have right now set up for my project. Why Netbeans creates an important files folder I have no idea for my CI project. I have edited the index file to have the application and system variable to both have the ../system or applicaton as its value. I have changed the Web Root inside the project properties to have a value of public_html and I have also changed the value of the Index File field to say index.php.
After doing this and running the project I would expect to get the default Welcome to Codeigniter page and I don't. I am receiving a message that shows the following. Any ideas on why this is?
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.16
Projects
- MyFirstProject
- Source Files
- application
- public_html
- assets
index.php
- system
- Test Files
- Important Files
- Include Path
I've tried doing some additional research on the topic and have yet to come up with a solution.
Edit 2:
Any ideas from anyone?
Your problem is likely related to your choice of folder layout. Which I assume you do, for "security reasons". That said, NetBeans isn't a server. Its an IDE, so you can't manipulate it the same way you would the server.
Most servers by default define your "root" folder as "public_html" or "www" as far as where it looks by default to serve files for public consumption. Through the use of PHP you can tell the index.php that comes with CodeIgniter to look up one directory outside of the defined root and have it read the file(s) accordingly.
However, to setup a project in netbeans and have all files and folder accounted for accordingly you need to tell it that all your files start in whatever folder they reside. So it can load all the files and read from them respectively. This in essence and in respect to server logic is telling it that the folder that houses
application
public_html
system
is the define root path. So inadvertantly by breaking out of the design of codeigniter and placing the core files outside of what would be your defined root on the server is breaking your project. There is not an index.php depicted in your listing above at the same level that those folders are in. If there is, its the index.php for xxamp that keeps loading for you by default.
What you need to do is stop trying to implement your "security measures" and put them in the right order. Or.. not include that folder in your project telling it the one with assets and index.php is the root path. If netbeans is smart enough it will find the files and folders outside like the server will.
Right click on your project and go to properties. Make sure that in the run configuration the URL is correct and the index file is properly set up and matches your directory in xxamp.
after downloading codeigniter open index.php file and there set your path correctly to your
application folder because i think you putted your index.php inside public_html folder so
the path which is set by default in index.php is not working and can not find application folder, try to fix it and it will work fine your problem is not with netbeans.

Categories