我一直在尝试configuration我的Apache服务器整天,但是我有一个php.ini文件被加载的主要问题。 当我尝试连接到我的数据库时,我得到这个错误: Call to undefined function mysql_connect() 得到这个错误后,我加载了PHP信息页面,并重新启动我的php.ini文件没有被加载从这里看到, 从我的php.info页面剪辑: Configuration File (php.ini) Path C:\windows Loaded Configuration File (none) Scan this dir for additional .ini files (none) Additional .ini files parsed (none) 我正在运行PHP版本5.6.21 这是在Windows机器上。 我在我的php.ini文件中完成的事情: 已经取消注释这些行: extension=php_mysql.dll extension=php_mysqli.dll 将扩展名更改为: extension_dir = "C:\php\ext" 也已经添加到我的apacheconfiguration文件: LoadModule php5_module c:/php/php5apache2_4.dll AddHandler application/x-httpd-php .php # configure the path to php.ini PHPIniDir […]
我们目前正在docker上运行apache2 / mod-php网站,部署到google kubernetes。 为了利用谷歌云日志logging的严重级别过滤,我在apache.conf中创build了一个LogFormat ,它将日志输出写为结构化的JSON。 现在我在日志中看到两个访问日志输出。 1是格式正确的CustomLog,另一个似乎是某种默认访问日志。 这里是Apache的conf: 1 LogLevel info 2 3 LogFormat "{\"message\": \"%{X-Forwarded-For}i %l %u %t '%r' %>s %b '%{Referer}i' '%{User-Agent}i'\", \"severity\": \"INFO\"}" common 4 CustomLog /dev/stderr common 5 6 7 ErrorLogFormat "{\"message\": \"[%t] [%l] [pid %P] %F: %E: [client %a] %M\", \"severity\": \"ERROR\"}" 8 ErrorLog /dev/stderr 9 10 <VirtualHost *:80> […]
我已经执行了两个命令通过SSH没有错误,当我试图通过SSH隧道连接到MySQL服务器即使我做了一个简单的查询,如select * from table我没有得到任何结果。 当我访问现场网站的PHP脚本时,我没有得到任何错误。 我得到这个错误: mysqli::mysqli(): (HY000/2002): Operation timed out当我访问本地托pipe的php脚本时, mysqli::mysqli(): (HY000/2002): Operation timed out 。 当然,它们都连接到远程MySQL服务器。 如果改变了一些东西,我在本地安装了Apache和MySQL。 当我通过MySQL工作台连接时,一切正常。 我也在my.cnf注释了这一行: #bind-address = 127.0.0.1 ssh -fNg -L 3307:127.0.0.1:3306 root@server_ip mysql -h 127.0.0.1 -P 3307 -u root -p database_name // PHP $mysqli = new mysqli("127.0.0.1:3307", "root", "root", "database_name");
在数据库/服务器pipe理方面的newb总数,但目前正在运行一个大型数据库: LAMP Stack Ubuntu WordPress平台(不能更改) 超过100,000个数据库条目 网站每天通过API添加新的条目 网站每天删除过期的条目2次 用户search关键字匹配的条目 一天下100个用户 服务器经常给出mysql-慢速错误,变得无法响应或使用> 200%的服务器资源。 (主要是CPU,似乎源于MySQLd进程)。 我正在Linode机器LAMP堆栈上运行: 4 GB RAM 4 CPU Cores 96 GB SSD Storage 19.72 GB swap 不知道从哪里开始了解这些types的问题。 如果有人能把我推向正确的方向来学习大型数据库的常见问题,甚至了解MySQLd如何使用CPU内存,以及如何更好地优化这些内容,那么这将是非常好的 – 正如我认为这样低的stream量,它必须是一个configuration问题或坏脚本。 我不希望任何人解决这个问题,我甚至不知道从哪里开始。
在迁移到新的VPS并尝试新服务器(Centos 7)上的网站后,Selinux以某种方式阻止http访问Postgresql: pg_connect():无法连接到PostgreSQL服务器:无法连接到服务器:权限被拒绝主机上运行的服务器“127.0.0.1”,并接受端口6432上的TCP / IP连接 是的,我的postgresql在端口6432,因为我们使用pgbouncer来减less服务器负载。 我search了一下,发现是因为Selinux,所以我使用selinux命令来允许httpd连接到db setsebool -P httpd_can_network_connect_db on ,它的工作方式与我在sel查看Selinuxconfigurationsestatus -b它已打开,但问题仍然存在。 .. pg_connect():无法连接到PostgreSQL服务器:无法连接到服务器:权限被拒绝主机上运行的服务器“127.0.0.1”,并接受端口6432上的TCP / IP连接 有趣的是,我知道这是因为Selinux原因,当我使用setenforce 0它的工作原理和连接到postgresql没有任何问题。 我该怎么办?
我有三台服务器。 两个是现场服务器托pipe网站的互联网。 一个是本地testing服务器,在互联网上看不到更大的。 我试图运行一个PHP脚本发布到Twitter ,它依靠curl。 当我在我的本地testing机器上运行脚本时,它完美的工作。 当我尝试运行在我的任何一台服务器上时,都会失败,并显示以下错误信息: PHP Fatal error: Call to undefined function Abraham\TwitterOAuth\curl_init() 在我的本地机器上,当我运行php –info | grep -i curl php –info | grep -i curl ,我得到这个回应: /etc/php5/cli/conf.d/20-curl.ini, curl cURL support => enabled cURL Information => 7.35.0 我只能通过SSH访问我的一台服务器(另一台是付费托pipe服务,受限制更多),当我在服务器上运行相同的命令时,我没有得到任何回应。 命令提示符没有任何回应。 但是,如果我转到我的实时服务器上的/etc/php5/cli/conf.d/目录,那里有一个20-curl.ini文件。 所有服务器都是基于Ubuntu的,我已经运行了apt-get install php5-curl curl ,他们都说它们运行的是最新版本。 这是所有服务器上最后一个令人困惑的细节,如果我在我的任何一台服务器,本地testing服务器和两台服务器上运行这个PHP脚本,我会得到一个积极的回应。 这是代码: echo 'Curl: ', function_exists('curl_init') ? 'Enabled' : […]
我是我的服务器上的php-fpm的nginx。 我使用SSL(Let's Encrypt)configuration了nginx,并将HTTPS设置为默认值而不是HTTP。 问题是当通过HTTP访问网页时,php文件被下载,但在HTTPS中,脚本工作。 我重新启动nginx / php清理caching,尝试其他浏览器,chmod和问题依然存在。 我使用ajenti作为控制面板,所以configuration是自动生成的。 client_max_body_size 128m; large_client_header_buffers 4 64k; add_header X-Content-Type-Options "nosniff"; add_header X-Frame-Options "SAMEORIGIN"; add_header X-XSS-Protection "1;mode=block"; add_header X-Content-Security-Policy "allow 'self';"; ssl_prefer_server_ciphers on; ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5; ssl_dhparam /etc/ssl/certs/dhparam.pem; ssl_session_timeout 1d; ssl_session_cache shared:SSL:10m; ssl_session_tickets off; ssl_stapling on; ssl_stapling_verify on; ssl_trusted_certificate /etc/letsencrypt/trustchain.pem; resolver 8.8.8.8 8.8.4.4; server { listen *:80 http2; listen *:443 ssl […]
这是在IIS 6.1(Build 7601:Service Pack 1)上运行的带有PHP 5.3.6的Windows 2008 R2 Standard Server 我在我的PHP.ini文件中有这些设置: error_reporting = E_ALL & ~E_DEPRECATED log_errors = On log_errors_max_len = 1024 error_log = C:/inetpub/temp/php_errors.log 也试过这些: error_log = C:\inetpub\temp\php_errors.log error_log = C:\inetpub\wwwroot\php_errors.log error_log = C:\windows\temp\php_errors.log phpinfo()报告上面显示的正确值。 但我仍然无法从PHP脚本获取任何代码写入日志文件。 我试过这个: error_log("Database not available!", 0); 甚至这个: asd(); 这可能是一个权限问题,因为我也不能写任何使用fwrite: $fp = fopen('MyErrors.txt', 'a'); // this should go into the […]
我已经按照以下步骤在服务器A上添加了mysql ssl支持: # Generate a CA key and certificate with SHA1 digest openssl genrsa 2048 > ca-key.pem openssl req -sha1 -new -x509 -nodes -days 3650 -key ca-key.pem > ca-cert.pem # Create server key and certficate with SHA1 digest, sign it and convert # the RSA key from PKCS #8 (OpenSSL 1.0 and newer) to the […]
是否有可能分开每个Apache虚拟主机的PHP错误日志? 我正在运行Apache / 2.4.10(Debian)和PHP 5.4.45(cli)例如我尝试php_value和PHPINIDir在我的Apacheconfiguration <VirtualHost *:80> …. PHPINIDir /usr/local/zend/var/log/my_host_php_error.log …. </VirtualHost> 与php_value相同的虚拟主机 <VirtualHost *:80> …. php_value error_log /usr/local/zend/var/log/my_host_php_error.log …. </VirtualHost> 之后,我得到这些消息: 无效的命令“php_value”,可能是拼错的或由未包含在服务器configuration中的模块定义的 无效的命令“PHPINIDir”,可能是拼错的或由未包含在服务器configuration中的模块定义的 是否有可能通过Apacheconfiguration?