Jump to content

SLSCoder

Members
  • Posts

    43
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

SLSCoder's Achievements

Member

Member (2/5)

1

Reputation

2

Community Answers

  1. OK thanks. I'll make that a preference as well.
  2. I have a table1 with an ID and a Name where the ID is found in a sql query on different table2. I have access to an existing PHP array containing all the IDs and Names of table1. For each of the records I find n the sql query on table2 I have a choice. I can either INNER JOIN table1 on table2 in the sql query and then include the Name in the query OR while looping through the query recordset, for each record found I can loop through the array of table1 and match the ID to the ID in the query record to get the Name. Which method is generally faster?
  3. I added the code in the page because it still would not display the errors. I wasn't confident that I had the 'right' php.ini file even though I did edit the one shown in php_info.php. Normally, that code wouldn't be there. I'm aware that & ~E_NOTICE turns off notices. My problem was that even if I have php.ini set as: error_reporting = E_ALL the page still wouldn't show the parse error. The error was caused by a missing semi colon and yesterday the page returned: This page isn’t working Today the error displays as it should. I've removed the error display code on the page and it still works fine. I *swear* I didn't change anything. Yesterday when I quit, it didn't work. Today, it works just fine. ?#)!@#$??? It's all good now. You guys are a lot of help. We appreciate you. Thanks
  4. This code works $sErr = "Hello World"; echo $sErr . "<br>"; This code makes the page display: This page isn’t working $sErr = "Hello World" echo $sErr . "<br>"; Why is it doing that and how can I make it show me the error?
  5. Yea, sorry. I'm working on it. It turns out that it seems to be doing it on compile time errors. What caused it to return This page isn't working was a missing semi-colon.
  6. I've been through this a hundred times. I cannot make php display errors consistently. My php.ini file has this: error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT display_errors = On display_startup_errors = On log_errors = On ignore_repeated_errors = Off ignore_repeated_source = Off report_memleaks = On Nothing exists below these params that would change them. I have a file https://dev.aecperformance.com/php_info.php which shows my php info. When I pull that up I see: Loaded Configuration File /etc/php/8.1/apache2/php.ini I don't understand why this is. It used to be in /etc/php/8.1/fpm php8.1-fpm is installed and is active. Whether or not php is actually using it I can't say. It should be using fpm. Nevertheless, I have uploaded the php.ini file to both: /etc/php/8.1/apache2/php.ini and to /etc/php/8.1/fpm/php.ini I've rebooted the server since making the changes to make sure that php is reloaded. On my web page I have: ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); STILL when I try to load the page I get: This page isn’t working https://dev.aecperformance.com/test.php How can I make PHP display errors and suppress warnings?
  7. I figured this out. The problem was not with the at command, the user www-data did not have permissions to create the directory. This is resolved.
  8. I should add that: The file /etc/at.deny does not include www-data (which is $_Server["user"]) The file /etc/at.allow does include www-data.
  9. Ubuntu 20.04 apache2 php 8.0.14 php-fpm I'm trying to execute an at command from php. The code is: $out = shell_exec('echo mkdir /var/www/test | at now +1 minutes'); echo $out . "<br>"; If I run that command from the command line it works fine. When I run it from php I get nothing back into the $out variable and no directory is created. How can I run an at command from php?
  10. I changed the php code to: echo $_SERVER['USER'] . "<br>"; The response this time was: www-data So now I'm confused. Is the logged in user root or www-data? I need the logged in user to be www-data, not root.
  11. ubuntu 20.04 php 8.0 I'm using php-fpm to run php from apache2 The file: /etc/php/8.0/fpm/pool.d/www.conf shows: user = www-data group = www-data The file: /etc/apache2/envvars shows: export APACHE_RUN_USER=www-data export APACHE_RUN_GROUP=www-data The file: /etc/apache2/apache2.conf shows: # These need to be set in /etc/apache2/envvars User ${APACHE_RUN_USER} Group ${APACHE_RUN_GROUP} When I run a php file with this code in it: echo get_current_user() . "<br>"; The response I get is: root Why is the logged in user root instead of www-data and how can I reset it so that the logged in user is www-data? Any help would be greatly appreciated.
  12. gizmola: Thank you for that response. I appreciate your information about MySql. I used to develop in VB ASP and then C#.NET using DBase then MS Sql Server so I guess I expected MySql to be more like Sql Server. The PHP code that creates these queries is over 1,000 lines. It's not so much that the 'query' would be that big, it's just versatile and the code has to cover every possibility. My reason for wanting to use sprocs in part was so that I don't have to run all that PHP code every time the query is used. Also, it does require more than 1 sql statement and I was hoping to do it all in one db communication. The queries are derived from user input. My intention was to create the query structure once and then from there all I'd have to do would be call it. That would speed the PHP code and I thought, also the MySql code. I've learned that I cannot create/store queries from client (I mean the browser) form inputs. From what I understand the only way I can prevent sql injection is with prepared statements (PDO or mysqli). That means I cannot *save* the queries and then reuse them. I have to rebuild them every time I use them. I have to store the parameters/values and then retrieve them every time I use the queries. That will *definitely* slow the app down. I expected to be able to save the queries (multiple sql statements) to something compiled & optimized by MySql and then be able to just use it repeatedly. I don't really care about the fact that sproc memory is allocated per connection. Generally, one person creates a report and that will be the only person who uses it. They will however use it over and over and over, sometimes for years. I appreciate that the people here do this for free. I've depended on forums like this to help me for as long as they have existed on the Internet. I've also contributed to them myself quite a bit. I *am* open to suggestions as to how to accomplish my goals. The only 'answers' I've gotten here involve prepared statements which prevent me from being able to *save* the queries. That means I have to retrieve the parameter/value pairs and then rebuild the queries in PHP every time I use them. Also there is *some* procedural code I would have liked to run in MySql. Thank you all for your help.
  13. If the people who wrote the Business Intelligence software could do it then why can't I? In fact, I am developing a tool much like theirs but for a slightly different purpose and probably not *quite* as complex. Thanks for your response.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.