Asterisk help needed

I was trying to solve the mgknight exploit issue, and I somehow bungled my Asterisk install. Freepbx is still working ok (the phones are fine), but when I try to open the management interface I get

"FATAL ERROR

Can not write to cache folder at schmooze-font/cache. Please run (from the CLI): amportal chown

Trace Back

/var/www/html/admin/libraries/BMO/Less.class.php:55 die_freepbx()
[0]: Can not write to cache folder at schmooze-font/cache. Please run (from the CLI): amportal chown

/var/www/html/admin/config.php:624 Less->generateMainStyles()"

I’ve tried running the amportal chown command as described, but that doesn’t seem to solve the problem.

I can stop and start amportal ok as far as I can tell, but most other commands give this error

“PHP Fatal error: Call to undefined function module_get_active_repos() in /usr/share/pear/Console/Getopt.php on line 0”

Any suggestions? I’m kind of at a loss.

Some of the primary “less” files that are used to generate “css” have been severely mangled beyond repair.

Is this a distro system?

Honestly I’m not sure, I just inherited this thing from my long gone predecessor and I’m trying to get it back up to speed… How can I tell?

I’m getting the same exact error on a brand new install. Centos 7, Asterisk 13, Freepbx 12 (tried git and latest). The less files are generating something in the cache folder:

ls -al /var/www/html/admin/assets/less/cache

total 7460
drwxrwxr-x. 2 asterisk asterisk 8192 Dec 12 18:06 .
drwxrwxr-x. 9 asterisk asterisk 4096 Dec 12 18:06 …
-rwxrwxr-x. 1 asterisk asterisk 31676 Dec 12 18:06 lessphp_1049n48gluf4wsk08cs0sswogg8kwk0.lesscache
-rwxrwxr-x. 1 asterisk asterisk 4161 Dec 12 18:06 lessphp_112de2ace60845aa90afcd122b9eae58.list
-rwxrwxr-x. 1 asterisk asterisk 142194 Dec 12 18:06 lessphp_a7090345ccc65545f9a8df35579c618538b4e8ba.css

The only additional info I found was in the /var/log/httpd/error_log:

[Fri Dec 12 18:56:36.017162 2014] [:error] [pid 11450] [client 175.180.68.68:52074] PHP Warning: file_put_contents(/var/log/asterisk/freepbx.log): failed to open stream: Permission denied in /var/www/html/admin/libraries/utility.functions.php on line 111

BUT all the permissions are correct, I’ve triple checked…

ls -al /var/log/asterisk
total 632
drwxrwxr-x. 5 asterisk asterisk 4096 Dec 12 05:01 .
drwxr-xr-x. 11 root root 4096 Dec 12 00:15 …
drwxrwxr-x. 2 asterisk asterisk 6 Dec 12 01:05 cdr-csv
drwxrwxr-x. 2 asterisk asterisk 6 Dec 12 01:05 cdr-custom
drwxrwxr-x. 2 asterisk asterisk 6 Dec 12 01:05 cel-custom
-rwxrwxr-x. 1 asterisk asterisk 298611 Dec 12 01:56 freepbx_debug
-rwxrwxr-x. 1 asterisk asterisk 331455 Dec 12 19:08 freepbx.log
-rwxrwxr-x. 1 asterisk asterisk 118 Dec 12 05:03 queue_log

ps -ef |grep http
root 11446 1 0 18:01 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
asterisk 11449 11446 0 18:01 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
asterisk 11450 11446 0 18:01 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
asterisk 11451 11446 0 18:01 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
asterisk 11452 11446 0 18:01 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
asterisk 11453 11446 0 18:01 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
asterisk 11454 11446 0 18:01 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND

ls -al /var/www/html
total 12
drwxr-x—. 4 asterisk asterisk 92 Dec 12 18:15 .
drwxr-xr-x. 4 asterisk asterisk 31 Dec 12 18:06 …
drwxrwxr-x. 9 asterisk asterisk 4096 Dec 12 18:10 admin
lrwxrwxrwx. 1 root root 36 Dec 12 18:10 cxpanel -> /var/www/html/admin/modules/cxpanel/
-rw-r–r--. 1 asterisk asterisk 453 Dec 12 18:06 index.php
drwxrwxr-x. 3 asterisk asterisk 18 Dec 12 18:06 recordings
-rw-r–r--. 1 asterisk asterisk 361 Dec 12 18:06 robots.txt
lrwxrwxrwx. 1 root root 38 Dec 12 18:15 ucp -> /var/www/html/admin/modules/ucp/htdocs

I do have AllowOverride All and Options FollowSymLinks in httpd.conf under <Directory “/var/www/html”> and I’ve ran amportal chown many times too…

Any ideas as to what it might be? Or what else to try?

I recently had a problem with permissions where the user “mysql” was the one trying to write data and failing, causing the GUI to fail on any page with a DB call. Try changing a directory’s permissions to 777 temporarily and then changing them back afterward to troubleshoot?

Was a good suggestion, but didn’t help.

I dont speak english good but i had the same trouble. You can try check upload-max-size in php.ini.Change on 120M.Also try open page freepbx /admin/ and show the last log in /var/log/httpd/error_log

I realize this is bit old and all, but, I just ran into this exact problem. Ultimately, aside from chmod’ing the php session dir (/var/lib/php/session) 0777, the ultimate fix was to run Apache as “asterisk” instead of “apache”.

/etc/httpd/conf/httpd.conf:

#User apache
#Group apache
User asterisk
Group asterisk

I don’t know if this will help anyone else that finds this thread via Google (like I did), but there you go.

M.