My Caddy File
http://bot.vibs.tech {
root /home/caddy/www/botsite
tls off
errors {
404 /home/caddy/www/botsite/404.html
}
fastcgi / 127.0.0.1:9001 php {
ext .php
split .php
index index.php
}
}
The Webpage http://bot.vibs.tech/test.php
Home Page http://bot.vibs.tech
My PHP Script
<?php
if($_POST["submit"]) {
$test=$_POST["botsname"];
$redis->set(';message';, $test;);
$value = $redis->get('message');
<p>$value</p>
}
if (empty($url)) {
echo "<h2><div style=\"color: Black;\">THANK YOU, YOUR BOT IS BEING MADE!</div></h2>";
echo "<h2><div style=\color: Black;\"><a href=http://bot.vibs.tech/>HOME</a></div></h2>";
}
Tried lots of different things, not sure what else i could try to do.
Also im trying to implement Redis to this so i can have a database from a form im currently working on.
Additional Info
tried /etc/init.d/php7.0-fpm status
● php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.0-fpm.service; enabled; vendor
preset: enabled)
Active: active (running) since Sat 2017-08-26 11:27:49 EDT; 4min 55s ago
Process: 17295 ExecStartPre=/usr/lib/php/php7.0-fpm-checkconf (code=exited, status=0/SUCCESS)
Main PID: 17304 (php-fpm7.0)
Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
CGroup: /system.slice/php7.0-fpm.service
├─17304 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)
├─17305 php-fpm: pool www
└─17306 php-fpm: pool www
Aug 26 11:27:49 Vibs systemd[1]: Starting The PHP 7.0 FastCGI Process Manager...
Aug 26 11:27:49 Vibs systemd[1]: Started The PHP 7.0 FastCGI Process Manager.
Hint: Some lines were ellipsized, use -l to show in full.
Says its started.
Also Did, ps aux | grep php-fpm
root 17304 0.0 0.8 211748 17128 ? Ss 11:27 0:00 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)
www-data 17305 0.0 0.1 211748 3224 ? S 11:27 0:00 php-fpm: pool www
www-data 17306 0.0 0.1 211748 3224 ? S 11:27 0:00 php-fpm: pool www
caddy 18003 0.0 0.0 11228 884 pts/0 S+ 15:33 0:00 grep --color=auto php-fpm
Related
This is the error I see in CodeIgnitor 4 on a new server installation.
Fatal error: Uncaught Error: Call to undefined function CodeIgniter\locale_set_default()
When I look at potential problems I see that I have the intl extension installed but when I do this command:
php -i | grep -i intl
returns
intl.default_locale => no value => no value
In addition to adding an actual locale like this in php.ini file:
intl.default_locale="en-US"
ensure that this extension is enabled... in other words remove the ; in this line...
extension=php_intl.dll
and after a restart this fixed for me.
So the solution I've found is to edit the PHP configuration files and add:
intl.default_locale="en-US"
I added it to /etc/php.d/20-intl.ini but your local configuration may vary.
Then I tested the apache configuration and restarted:
apachectl configtest
apachectl restart
The error didn't go away so I continued my search and found php-fpm was running:
ps auxwww | grep -i PHP
which returned
apache 10499 0.0 0.4 292148 16672 ? S 17:07 0:00 php-fpm: pool www
apache 10502 0.0 0.4 292148 16696 ? S 17:07 0:00 php-fpm: pool www
apache 10503 0.0 0.3 290076 13756 ? S 17:07 0:00 php-fpm: pool www
apache 10504 0.0 0.3 290076 13768 ? S 17:07 0:00 php-fpm: pool www
apache 10506 0.0 0.2 288028 11624 ? S 17:07 0:00 php-fpm: pool www
apache 20201 0.0 0.3 290076 13744 ? S 17:16 0:00 php-fpm: pool www
so I restarted that service with this command:
service php-fpm restart
and now everything seems to be running perfectly. There were still a few permissions issues to address with a new install of CodeIgnitor but those are for another post.
How do i run php-fpm master process as non root user
root 10275 0.0 0.5 192856 23104 ? Ss Nov20 0:01 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)
I have on my server running custom php process /etc/php/7.1/fpm/master.d/custom_name.conf
root 2620 0.0 2.6 412440 26808 ? Ss May31 0:33 php-fpm: master process (/etc/php/7.1/fpm/master.d/custom_name.conf)
root 6822 0.0 0.0 13384 916 pts/1 S+ 19:58 0:00 grep php
root 27575 0.0 1.1 410680 11828 ? Ss May31 0:33 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
www-data 27578 0.0 0.5 410680 5760 ? S May31 0:00 php-fpm: pool www
www-data 27579 0.0 0.5 410680 5760 ? S May31 0:00 php-fpm: pool www
And config exists in directory /etc/php/fpm/master.d/custom_name.conf.
But i don't even know how to restart this service. I changed file config and tried service php7.1-fpm stop but the process is still alive.
If I try service php7.1-fpm start or service php7.1-fpm restart process /etc/php/7.1/fpm/php-fpm.conf appears, but old process still working. Maybe command service php7.1-fpm has parameters where i can pass extra config data. Example config file from master.d directory
Here is config of this file /etc/php/7.1/fpm/master.d/custom_name.conf:
[global]
pid = /run/php7.1-fpm.custom_name.pid
error_log = /var/log/php7.1-fpm.log
[custom_name]
user = custom_name
group = custom_name
listen = /var/run/php7.1-fpm.custom_name.sock
listen.owner = www-data
listen.group = www-data
pm = ondemand
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 20
pm.status_path = /fpm-status
chdir = /
catch_workers_output = yes
php_admin_value[session.save_path] = /var/www/custom_name.com/sessions
php_admin_value[open_basedir] = /var/www/custom_name.com/code/public:/tmp:/usr/share/php:/var/www/tools/
php_admin_flag[log_errors] = on
php_admin_flag[opcache.enable] = on
Thanks in advance
Finally hoster said me how restart this process:
sudo service php7.2-fpm#custom_name restart
Perhaps i'm missing something extremely basic, but how is it that my web server is able execute and serve content from php files that have permission 000?
Here's the file in question: http://178.62.125.162/test.php
Location is:
/usr/share/nginx/html/wordpress/test.php
Here's the ls:
---------- 1 deploy deploy 21 May 22 09:40 test.php
nginx.conf has line:
user www-data;
So it's not running as root or anything.
ps aux | grep [n]ginx
root 30223 0.0 0.1 85876 1364 ? Ss May21 0:00 nginx: master process /usr/sbin/nginx
www-data 30224 0.0 0.1 86172 1796 ? S May21 0:03 nginx: worker process
www-data 30225 0.0 0.1 86172 1796 ? S May21 0:03 nginx: worker process
www-data 30226 0.0 0.2 86516 2732 ? S May21 0:00 nginx: worker process
www-data 30227 0.0 0.1 86172 1796 ? S May21 0:03 nginx: worker process
Looks normal to me, AFAIK the master process running as root is expected.
And php-fm:
ps aux | grep php
root 30311 0.0 1.8 309068 18580 ? Ss May21 0:02 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
www-data 30314 0.0 3.5 393324 36176 ? S May21 0:01 php-fpm: pool www
www-data 30315 0.0 3.1 388956 32112 ? S May21 0:01 php-fpm: pool www
www-data 30391 0.0 2.9 389828 29528 ? S May21 0:00 php-fpm: pool www
I can't even open the file myself, logged in as deploy:
cat test.php
cat: test.php: Permission denied
php test.php
Could not open input file: test.php
Googled everywhere, but most things I find are related to the opposite- people getting Forbidden errors.
Perhaps it's because it's in /usr/share? Thanks!
Extra info:
Ubuntu x64 LTS
PHP-FM
Update:
Restarting the php-fm service after changing the permission fixes it. But this makes no sense to me:
chmod 000 test.php - web echos "test"
service php5-fm restart - Access Denied
chmod 644 test.php - web echos "test". No need for a restart this time?
chmod 000 test.php - web echos "test".
Thanks to Alexander Ushakov for providing the answers.
The file with the readable permission had been cached by php-fm. Restarting php-fm meant that the cache was cleared and the web server then served the new file with the restricted access.
I want to lock a file by flock. I read the documentation and it says that
These locks only apply to the current PHP process.
So what is a PHP process ? If there is a PHP project inside a web server , and there are many clients opening the project on their computer's browser , are all these clients computers starting different PHP processes ? If so , does flock then really lock in that situation ? What I want is to lock a file on a webserver if I am the first accessing the file , even if there are many other clients computers trying to launch the same functionality on a page !
This all depends on which os and how you have your server and php setup through the web server. On windows, I believe its one php.exe process which shouldn't be too difficult to grasp. On linux, one php process handles each apache request.
For example, I issued >
ps aux | grep php
I got:
root 4346 0.0 1.6 345920 19068 pts/0 T Mar12 0:04 emacs mission_insert.php
this show that I opend a php file called mission_insert.php with emacs, which doesn't show anything about a php request but its handled through httpd/apache.
When I issue >
ps aux | grep httpd
I get the following:
root 3255 0.0 2.3 616964 27720 ? Ss Mar11 0:22 /usr/sbin/httpd -DFOREGROUND
apache 7227 0.0 1.8 723060 22040 ? S 03:35 0:01 /usr/sbin/httpd -DFOREGROUND
apache 7228 0.0 1.7 722828 20752 ? S 03:35 0:01 /usr/sbin/httpd -DFOREGROUND
apache 7229 0.0 1.7 723500 20136 ? S 03:35 0:00 /usr/sbin/httpd -DFOREGROUND
apache 7230 0.0 1.8 723008 22324 ? S 03:35 0:01 /usr/sbin/httpd -DFOREGROUND
apache 7374 0.0 1.7 723136 20868 ? S 09:38 0:01 /usr/sbin/httpd -DFOREGROUND
apache 7380 0.0 2.0 725124 23840 ? S 09:38 0:01 /usr/sbin/httpd -DFOREGROUND
apache 7381 0.0 1.8 725140 21392 ? S 09:38 0:01 /usr/sbin/httpd -DFOREGROUND
apache 7382 0.0 1.9 724620 22880 ? S 09:38 0:00 /usr/sbin/httpd -DFOREGROUND
apache 7385 0.0 1.7 723028 20864 ? S 09:38 0:01 /usr/sbin/httpd -DFOREGROUND
apache 7578 0.0 0.9 617232 11396 ? S 10:22 0:00 /usr/sbin/httpd -DFOREGROUND
root 7628 0.0 0.0 112640 960 pts/0 R+ 11:27 0:00 grep --color=auto httpd