Magento CSS and JS in head including from document root? - php

I have just set up a new server running ubuntu and all the latest versions of apache mysql and php, also with all the necessary extensions for running Magento.
I've transferred my test site across to the new server and everything works accept styles and scripts, for some reason they are including from the document root (/var/www/vhosts/site.com/httpdocs/), the strange thing is it seems only the js and css added using XML is wrong.
I've checked the core_config_data table and the urls are correct, all file permissions are correct safe mode is off memory_limits etc have been checked.
Could this have something to do with the apache2 setup?

This has to do with the fact that you have enabled CSS/JS merging, but Magento doesn't have sufficient access rights to write the merged files to media/css and media/js.
chmod o+w -R media
That should fix your problem.

Related

Configure Drupal temporary directory outside of web root

I am trying to configure the temporary directory on my Drupal install. Previously, I have been on a cPanel shared account, and all I would simply do is add '../tmp' to the settings and it all worked fine. I have recently outgrown my shared account and upgraded to a VPS, with CentOS and VestaCP. Now, when I enter '../tmp' it says that the folder 'does not exist and could not be created.' I have checked, and that folder is indeed there via file manager and FTP, is 755 permissioned etc. No matter what I try, it just doesn't seem to want to acknowledge it is there.
My CentOS and VestaCP installs have had VERY little tweaking, so they are pretty much default installs at the moment. I was advised to try a path such as:
/home/admin/web/MYDOMAIN/tmp
Other attempts have been:
/tmp and /home/admin/web/*/tmp
But they all threw up the same error. If I type just 'tmp', it works fine, but is then obviously within the web root directory, which is not ideal. Help?
In the end, it turned out that the best way is to use the pre setup and designated tmp folder for the whole install, which is located at /home/admin/tmp. This also allowed for uberCart credit card processing as well, which wasn't available via a normal ../cc either. The folder also allows for directories, so you could separate between domains and requirements, i.e.
/home/admin/tmp/domain.com or /home/admin/tmp/cc/domain.com

Clearing cache manifest via CLI

I've automated the deploying of my site and I have a script that runs framework/sake /dev/build "flush=1" This works however it clears the cache directory of the user who runs it, which is different from the apache user (which I can't run it from).
I've read a few bug reports and people talking about it on the SS forum however either there is no answer or it doesn't work for example
define('MANIFEST_FILE', TEMP_FOLDER . "/manifest-main");
I thought about just deleting the cache directory however it's a randomised string so not easy to script.
Whats the best way to clear the cache via command line?
To get this to work you need to first move the cache from the default directory to within the web directory by creating a folder silverstripe-cache at the web root. Also make sure the path is read/write (SS default config blocks this being readable by the public)
Then you can script:
sudo -u apache /path/to/web/root/framework/sake dev/build "flush=1"

php url and folder name

I just installed the latest MAMP on Mac, and found this hard to understand:
The document root seems to be "~/MAMP/htdocs", because "localhost" will open the index.php file under this folder.
However, "localhost/MAMP/?language=English" opens "~/MAMP/bin/mamp/index.php". I know that in URL strings between "/"s are not necessaries folders, but if they are not folders, how was it constructed and how does the system know where to find the right files?
I know this is a pretty basic question which I can probably get answers by myself, but I don't know what key word to search. Tried "php url construction" and "php url folder" but no luck. So a proper keyword suggestion is also appreciated.
It is setup by default by MAMP. If you open up MAMP/conf/apache/httpd.conf in a text editor and scroll down to around line 368/369 and specifically line 408 you will see that it is an Apache Alias. it is setup for easy navigation, instead of having to type http://localhost:8888/bin/mamp you can just type http://localhost:8888/MAMP. It is also setup as an Alias to ensure that you can still access the web tools if you change the document root from something other than /Applications/MAMP/htdocs.
Are you sure http://localhost:8888 has the docroot set to ~/MAMP/htdocs as you suggest? Reason I ask is that looking at your first image the text says the docroot is /Applications/MAMP/htdocs. Also the docs say it should be in the /Applications/MAMP/htdocs. I think the issue is that you do not have MAMP in the Applications folder where it needs to be.
https://www.mamp.info/en/documentation/
Where should I store my HTML and PHP pages?
By default, PHP and HTML Pages should be stored inside the MAMP
"htdocs" folder which is located in the MAMP Application directory
/Applications/MAMP. This folder is called "Document Root". You can
change the path for the Document Root in the MAMP application's
Preferences Panel:
Also please note this https://www.mamp.info/en/documentation/#q8
Will MAMP work if the MAMP folder is not located in the Applications
directory?
No. In order to work properly the MAMP folder has to be located in the
Applications folder.

WordPress - unable to upload images

I have a WordPress site on my webserver and have recently copied it to my localhost testing environment using XAMPP (bitnami) to work on it, and proceeded to re-upload the site back to the server without issue.
Now, everything is functioning fine except for uploading images. Whenever I attempt to upload them, it says it cannot write to the directory.
I have tried turning off date/time arrangement of images, I've tried manually creating the folder its trying to use and temporarily setting the permissions of it to 777 and it works. However, when I change them back to 755 it stops allowing uploads again.
Like I said this has only happened since copying my localhost wordpress back. I've read it may be due to the account WordPress is using to create/write files. Is there any way to find out what this account is? And how would I ensure it has the correct permissions? Could it somehow have inherited the Bitnami XAMPP WordPress account since I copied the files/DB over?
I have access to my sites cPanel if that helps.
don't change permissions change owner
sudo chown www-data:www-data /folderName

openshift wordpress serving old pages, ignoring header.php changes

I have openshift with wordpress cartridge.
I need to edit/write php files, and have done so via Wordpress theme editor page.
( i have confirmed by sftp that it did edit the files)
Also I have also edited php files localy, then uploaded them by sftp.
( I do not use git, because by default it does not include all the relevant directories, and is useless to me)
All the php files are in directory:
/var/lib/openshift/53....555/app-root/data/themes/purple-pro
What is supposed to happen, is html output is meant to change, after php file changes.
It does not.
Try restarting your app with rhc app restart -a <yourappname>
For other people having problems with openshift and editing php files.
It seems all PHP Files are cached/compiled, and even deleting a info.php file, still serves a old output webpage.
recomended solution is: use git so it can restart your webserver ( while also it deletes your wp-content directory ffs)
Actually works solution is:
use a linux terminal:
rhc app restart -a myapp
Viola, all the php files now run.

Categories