I recently switched to Ubuntu. One of the tools I frequently used was XAMPP. When I installed LAMP stack on Ubuntu I noticed a major performance increase and was quite please with it. However, after literally spending days and reading dozen of how-to articles, I still couldn't set it up right.
I ended up installing apache2
+ php5-fpm
because it cane execute the files with the permissions of the user.
However that didn't still quite work out for me. For example, I downloaded an archive of a popular CMS and extracted it to Apache html directory. The resulting permissions on those files are 0664
and 0700
on folders.
Apache directory rules:
<Directory "/home/myuser/www/">
AllowOverride All
Require all granted
Allow from all
</Directory>
When AllowOverride All
:
[Fri Dec 12 21:16:01.037580 2014] [core:crit] [pid 23745:tid 140466931369728]
(13)Permission denied: [client 127.0.0.1:54670] AH00529:
/home/myuser/www/mycms/install/.htaccess pcfg_openfile: unable to check htaccess
file, ensure it is readable and that '/home/myuser/www/mycms/install/' is executable
When AllowOverride None
, apache2 runs index.php
which is at root directory, but won't run /config/index.php
[Fri Dec 12 21:02:41.552369 2014] [core:error] [pid 22530:tid 140517706823424]
(13)Permission denied: [client 127.0.0.1:54465] AH00035: access to
/install/index.php denied (filesystem path
'/home/myuser/www/mycms/install/index.php') because search
permissions are missing on a component of the path
I'm not too well-versed in apache directory rules yet, maybe there is some error in there. Should the index.php
file be readble? The php5-fpm
service runs as my user:
/etc/php5/fpm/pool.d
Line 22: user = myuser
Line 23: group = myuser
The files run when I set chmod -R 0755 www/
. However, I can't keep running this command every time I add some files or when they are created by php. Isn't there a way to work without constantly tampering with the permissions? I asked a colleague and he just said: "Set the root
user for php5-fpm
service". However, this is more of a make-shift escape solution. I am also afraid that I may run some glob/*
functions and delete files which I didn't mean to delete (has happened to me in the past).
How can I set up my LAMP stack to automatically be able to run all my files?
If there is good guide on how to set it up with suphp or some other mod, I would hapilly look at it. But it has to work all the way.
Edit
ps aux | egrep '(apache|httpd)'
root 18763 0.0 0.1 84256 4720 ? Ss 21:35 0:00 /usr/sbin/apache2 -k start
www-data 18767 0.0 0.1 373432 6256 ? Sl 21:35 0:00 /usr/sbin/apache2 -k start
www-data 18768 0.0 0.1 373432 6256 ? Sl 21:35 0:00 /usr/sbin/apache2 -k start
gskema 20515 0.0 0.0 14884 2364 pts/6 S+ 21:37 0:00 grep -E --color=auto (apache|httpd)
ps aux | egrep '(php)'
gskema 8312 0.0 0.0 4448 492 ? S 16:32 0:00 /bin/sh /opt/phpstorm/bin/phpstorm.sh
gskema 8361 8.7 31.0 4630304 1245684 ? Sl 16:32 26:52 /usr/lib/jvm/java-8-oracle/bin/java -Xms128m -Xmx750m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -Djsse.enableSNIExtension=false -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -Dawt.useSystemAAFontSettings=lcd -Djb.vmOptionsFile=/opt/phpstorm/bin/phpstorm64.vmoptions -XX:ErrorFile=/home/gskema/java_error_in_WEBIDE_%p.log -Xbootclasspath/a:/opt/phpstorm/bin/../lib/boot.jar -Didea.paths.selector=WebIde80 -Didea.platform.prefix=PhpStorm -Didea.no.jre.check=true -Djb.restart.code=88 com.intellij.idea.Main
gskema 8396 0.0 0.0 4936 904 ? S 16:32 0:00 /opt/phpstorm/bin/fsnotifier64
root 18950 0.0 0.6 348744 24312 ? Ss 21:35 0:00 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
www-data 18953 0.0 0.1 348744 7836 ? S 21:35 0:00 php-fpm: pool www
www-data 18954 0.0 0.1 348744 7836 ? S 21:35 0:00 php-fpm: pool www
gskema 20649 0.0 0.0 14888 2364 pts/6 R+ 21:40 0:00 grep -E --color=auto (php)
I ran a command and I see that there are multiple? processes running. Can someone comment on these?