Jump to content

gizmola

Administrators
  • Content Count

    5,128
  • Joined

  • Last visited

  • Days Won

    60

Everything posted by gizmola

  1. This SO thread covers a lot of the probable issues with getting phpMyAdmin running and accessing it including: Did you start the MySQL server? Did you configure phpMyAdmin to access the MySQL server? What url should phpmyadmin be at?
  2. Provide an example of what you mean by that, and how you plan to use it.
  3. Here's a really good article about this issue (and other related ones you might not have though about either: https://www.danielmorell.com/guides/htaccess-seo/redirects/https-www-and-trailing-slash For example another related problem: https://www.mysite.com/foo/bar and https://www.mysite.com/foo/bar/ Will be seen as 2 different urls, so you want to effectively remove the trailing slash when you are routing a non-directory.
  4. This is a self fulfilling prophecy of failure. First off, you don't need to be an OOP expert to use classes and objects. With all the time you've spent here explaining to everyone why you can't or won't take their advice, you could have already watched the video, and learned a few things about modern PHP. Consider this my white flag. I give up. 🏳️
  5. I'm not familiar with this protocol. Are there other details (authentication or encryption for example) that might explain your result?
  6. This is not a teacher - student situation. As it happens, I have a good friend who is a college professor, as is his wife, and we talk about his classes and students fairly regularly. I know from his point of view, having standards that students have to meet is very much part of the job. There are assignments and tests. None of this is part of our discourse. In general, one of the most important elements of a community like this is the exposure to new ideas, technologies and methodologies, as well as exposure to a consensus on a baseline of competency. Your replies frequently seem to me to have elements of both FUD and NIH. I'm guessing you are familiar with both acronyms. I understand that you are concerned about what you don't know, and are unsure in regards to your ability to learn things that are new to you in the short and long term, but these topics did not come up by happenstance. You posted questions soliciting feedback, which is what you've received. In all the replies and feedback, I don't know if there's an instance where someone gave you an answer or opinion you've agreed with, that wasn't yours to begin with. It feels to me like an echo chamber, where you only want people to tell you that you were right from the get go. You seem to want to reduce this to a matter of opinion amongst equals, when that just isn't the case. I've done system architecture and engineering for my entire career. I know what's important, and I've tried to help you understand what that is, in dribs and drabs. I could at this point make a nice list of all the things you've disregarded, along with various excuses for why you know better than me what you need right now. At the end of the day, if we listed the requirements for what you want, what you've already built and how they can be integrated, sans a serious discussion of whether your requirements are sane or logical, or even prioritized correctly, there's a best practices way to build something new, and there's a way to make spaghetti, that will likely be a costly bug ridden failure. What the experienced practitioners here all know, is that doing it the right way isn't more difficult, nor does it take longer. Quite the contrary in fact. Doing it the right way produces a better product in less time because it's based on the assembly of pre-built and tested pieces, that more often than not have documentation and support. Again, I do this to try and help others, as do the other respondents who frequent this site. Some percentage of people find what they are looking for and some percentage do not. Most of us have been participating in this forum for many years. We've seen every type of question and questioner there is at this point. You might want to consider that when you question the relevance or urgency of the advice you've received.
  7. Did you look at the links I provided? There's not much more to it. Pack will let you pack the bytes into a binary string. You make the socket connection and fwrite the packed string to it.
  8. The comments and concerns expressed in that SO question are in no way applicable to what you are talking about doing. You might also note that the author of the comment, never demonstrates the supposed danger or where the section you quoted in any way matters. The most comical thing about it, is that there is no semi-truck table. The original requirement was completely lost. The ultimate model added to the original question does nothing other than to add tables only relevant to the car tree hierarchy. Adding a unique index and referencing that as a foreign key only matters in that scenario because there is a cars table where lots of different car subtypes could go. Are you implementing a hierarchy with multiple subclasses and sub-subclasses? No you aren't. Did you look at the other answer from Walter Mitty? It literally calls out the solution I provided you with the tag shared-primary-key I made you a model and generated the DDL. You could have run it in a test db and played with it, and created a few queries. Could you create a row in a subtype table for the wrong product type? Yes. But considering the missing semi-truck table, the same issue existed in the non-solution presented and accepted in the question you referenced. The main focus of the solution was the hierarchy of car types, which again isn't relevant to your product subtypes. It's not a concern for you because the procedural code you need to write, which uses the product_type attribute to determine which child table the subtype row needs to be created in, must do that properly for your system to work. If it doesn't do that properly 100% of the time, then your system doesn't work at all, and we are talking very simple logic. If you are super paranoid, then a simple trigger could be written to prevent it happening in any of the child tables. You could also, as an alternative, write a trigger to create the row in the correct subtype table, when you insert the product row. Ordinarily I am not a big fan of MySQL triggers or sprocs, as they reduce concurrency and insert performance, but your system will not have a lot of insert/update activity against the tables in question, and will primarily be selecting the data, so it's worth considering.
  9. Aside from the things Requinix listed, another thing that influences spam scoring is having a valid reverse DNS. Here's a list of some services you can use to check your rep: https://sendgrid.com/blog/5-ways-check-sending-reputation/. You also have to make sure your domain and your MTA IP is not on a RBL. The reality is that sending email from a Shared server is only as reliable as the worst client they have had on the server, or your ISP, depending on how email works for you with your hosting company. The other issue is that some systems may consider your emails to be spammy. Most analysis works on a scoring system, so if your emails are getting rejected outright as spam, that tells you something. Throttling isn't going to help you improve your score, and depending on the server you are communicating with, getting help with finding out how and why you are being rejected may be next to impossible for you. This is another reason to use a commercial email delivery company, since it's their business to insure delivery of client emails, and they have paid staff to correspond with sysadmins of major email systems.
  10. Yes. Take a look at stream_socket_client and pack. I don't think this type of application is PHP's forte, but it is possible. Creating an executable with c, c++ or Go would be a simpler final product upon completion, but PHP is certainly capable.
  11. You have Xampp, so you do have a database. The 'M' in Xamp stands for MySQL database. You can use the phpMyAdmin that is installed with your Xamp to create the tables. Again, you have to learn something about MySQL and the SQL queries, but as they will be very simple as far as SQL goes, that should not be a problem. Let's assume you name your table Medialist... All you will need is: SELECT * FROM Medialist INSERT INTO Medialist (columns..) VALUES (?, ?, ?...) DELETE FROM Medialist where id = ? UPDATE Medialist set column = ? where id = ? The basics of doing this is covered in the tutorial video I linked. My suggestion to you is to follow along and create the application with the tutorial. Doing so will teach you 95% of what you need. Then use what you have learned to create your app. Once you have most of it working, it will be feasible for people here to help you with the last 5%
  12. Here's what you want: header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1. header("Pragma: no-cache"); // HTTP 1.0. header("Expires: 0 "); // Proxies. Major Stackoverflow discussion of this topic. Keep in mind that if you are using sessions, PHP session configuration can screw with your cache control settings: Read about session-cache-limiter.
  13. A step by step tutorial on how to build your specific application is the same as writing it for you. Nobody is going to do that. You are going to have to learn some PHP. I already suggested to you that a TODO list app is very similar to what you need. Here's a tutorial in 3 or 4 parts that covers building a UI, making Ajax calls, writing PHP scripts to persist the data in MySQL and writing the persistence code using the PDO api. My suggestion to you would be to follow this tutorial and see if you can build it. At that point, you would be able to take the TODO app, and tweak it to fit your application.
  14. Which is why I linked you to a tutorial that shows you how to fix your mysqli code and use prepared statements. Did you bother to look at that? Did you make an attempt to refactor your code?
  15. I also realized that you might be asking about deployment. Again, this has a lot to do with the target production infrastructure. Lots of companies have a Devops group to work on deployment. More often than not, companies are using Github or Gitlab or Bitbucket. From a simplicity point of view, a real simple way of handling deployment is: You develop and test. If you have lots of tests, which most companies do, then they are doing continuous integration, where test servers run on every branch, and merging code only happens if all the tests pass. Then a manager/lead will do a final production merge, typically from a pull request, and version the code. That build can then be gotten from the git repo, perhaps via a version tag. What is even simpler for a small system perhaps with one developer is to use bitbucket or github with a private repo. You set up a read only user that can checkout/pull from your repo, and you configure your production environment's effective user for the application as that user. Getting the new build into production is as simple as git pull, or perhaps git checkout tag-name.
  16. Yes, that is what most developers are doing. Truthfully, I don't want to blow your mind, but for quite a while people have been using some form of virtualization as well. That provided a best of both worlds, where you have a deployment server environment (usually centos, ubuntu or whatever) running in a virtual machine, with drives mapped into it from your mac. For a time people were typically using virtualbox & vagrant. You'd install these, grab a vagrant file for the os you wanted (often with a stack preinstalled), and vagrant would download and configure the virtual server in virtualbox. This is still viable and works very well and is extremely simple. You might try going down that path. Setting up xdebug with any "remote server" even if it's a virtual machine running on your mac, can be a little complicated and have pitfalls, but otherwise, it's a great option. Here's an example Centos7 with LAMP stack vagrant: https://app.vagrantup.com/Gigasavvy/boxes/centos7-LAMP More recently people have moved to utilizing containers. The most popular container wrapper is Docker. So now, people are using Docker instead of the vagrant/virtualbox combo more often than not. There are some advantages in that docker is more compatible with running a cluster of virtual containers in the cloud, which is often done using an "orchestrater", the best known of which is Kubernetes. It doesn't really matter whether you grok all this stuff or not -- it's very sysadmin/devops specific stuff, but truthfully if you want to know what most companies that have SAAS or PAAS infrastructures or just large web based systems are doing, they are using Docker regardless of the stack. There are things as elaborate as Devilbox, which literally gives you a mega wamp/mamp style system, with options galore. If you install Docker you can tryout things like Devilbox. There's also Laradock which offers a similar even more development oriented docker file build that was put together for Laravel developers, but can be used more generically. You can also look for more minimal docker files that just set up a few different containers (apache + mysql +php) for example and articles like this one that will walk you through creating a docker file from scratch to your requirements. Vagrant is still great and extremely simple, but Docker is more current as a development environment virtualization solution. Unlike Vagrant, which just simplifies running a virtual linux server, Docker has some complexity specific to running containers, and certainly has a bigger learning curve, but if you want to do what most pro developers are doing, then I'd invest the time in playing with and learning the basics of Docker. If you just want to get a dev environment up that matches your target deployment environment, go with a vagrant. In either case, you need a pretty good working understanding of linux and the different ways of installing from packages.
  17. 11 years ago, it was unusual for people to use UTF-8. This was also before HTML5 became the defacto standard, but previous to that, people often used a particular character set, so check your app to see what if any meta charset it's setting. <meta charset="UTF-8"> //or possibly <meta charset="ISO-8859-1"> In the past it was not uncommon for people in the west to use ISO-8859-1 as it covers english and a lot of the european languages, and Finnish and Swedish. There is also ISO-8859-4 which supports "Scandinavia/Baltic". They overlap to a fair degree, but obviously there are some characters that are different. As requinix stated, we really need more info on the OS of the server. Again, going back 11 years, windows servers were still possibly using a codepage rather than unicode. There's also some issues with different OS's as to the support or lack thereof for case sensitive filenames. It would also be helpful if you could provide a specific example of a file that has one name on the filesystem and displays as garbage or something else in your app.
  18. So now you need some sort of persistence mechanism. This is a small application that requires some programming to accomplish. I have known people to write a lot of code to help out people in the past, but generally speaking, you have to come with some code, and some aptitude for learning, and some desire and elbow grease. I am not sure how we could help you further, that doesn't involve us writing your small web app for you. I can say this structurally, that this is very similar to and could be based on a mysql backed todo list application. Todo lists are frequently used as basic programming proficiency projects, so there are probably some you can find that you could make minimal modifications to and get a big jump start on this: You need a simple database or other persistence solution. Most people would use MySQL. Alternatively, you could persist the data as a file. I'd probably use json format, but then you would need to deal with file io routines. If you did use a database, the database for this system only needs a single table, so that's good from a simplicity standpoint You need an entry form that displays the current list of items from the database, and lets you add, edit, or delete and optionally reorder items. The same form can have a generation button that goes through the list of database items and generates the xml file I don't know if, like RSS this xml file needs to be available at a url or you actually need to generate the xml as a downloadable file, although there's not much difference between the 2. Still it does matter. The image paths are ambiguous. Are these images that should be hosted on your server? The relative paths suggest that is the case, but you didn't specify. If you need to be able to upload images and set that attribute from a list of images, then you need a subsystem/feature that lets you submit an image through the form, and a feature that allows you to pick from the list of pre-existing images when you create or edit an entry. It's a good chunk of work, and maybe a day (non optimal time) project for an experienced programmer. If you're learning, I will say it sounds like a cool project. If there is some specific thing that doesn't involve asking someone to write this for you, please let us know.
  19. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ You can find these described in a few different ways. Here's an article for you to get you kickstarted on looking into them: https://www.isitwp.com/smtp-transactional-email-services/ Depending on your volume, some of these services have a free tier, but depending on the amount of email you are creating you might need to pay for them. One benefit that most of them have is access to the types of log information that you would otherwise need to be a sysadmin for. Some have programmatic api's and some you just configure smtp-to-smtp, so you don't even have to change your current code or setup, other than to configure your MTA. Since you stated you are on a shared server, you probably don't have any option to mess with the MTA, so you'll likely have to reconfigure. There are also full maillist SAAS providers like Mailchimp or Constant Contact that are specifically built to offload email list services. This may or may not be something worth looking at for you.
  20. My point with phpMyAdmin is that it is a tool that hides all the details from you. So yes you can go in and make a table, add indexes, relationships etc., table by table. Than you can go in and add things. The expectation of the tool is that its for people who don't really know SQL. It's ubiquity is largely a function of the fact that it's been around a really long time. The basic ingredients are: 1st time creating a table = CREATE TABLE Changing something = ALTER TABLE But neither of these is a script you can play and replay. The time it will take you to make all the tables with phpMyAdmin is guaranteed to be equal to or greater than the time to make an ERD in workbench, with none of the quality, and no ERD diagrams to look at when you're done. I refer you to the other thread on foreign keys and the subtype. Having read your post: I Installed Workbench on my mac ran it for the 1st time ever Made a model of the tables (click type click drag) Related the tables (click drag) Generated the diagram generated the SQL I put in the thread Took me about 15 minutes or so, and I was doing this while talking to my kid. I have never used Workbench to make a diagram ever before. There was one non-intuitive thing I had to figure out but overall it was a lot more functional than I expected. There are things I've mentioned like domains, that I probably would want to use that I didn't attempt to figure out in it, but again I spent absolutely no time learning it. Now I grant you that I've used about 5 different commercial tools over the years, so I know what I'm looking for, but I just don't believe it would take you that long to figure it out. I'm also sure there are probably 50 video tutorials on the basic of it on Youtube. Also FYI these tools including workbench have a reverse engineering feature where they will read either a live db schema or a db dump and bring the existing model into the tool. Again, I'm beating a dead horse here. I think you've built these things up in your mind. Using workbench to digitize your diagrams is not the same as becoming a master of photoshop. I will do my best not to bring it up again
  21. Every PHP framework I know of has some form of ORM, back to CakePHP and Codeigniter, to Zend Framework. The 2 big boy PHP frameworks are currently Laravel and Symfony. Laravel has Eloquent, and Symfony has Doctrine (which is a separate project). It's possible to use Doctrine with any framework, and it's not uncommon for people to use Zend Framework with Doctrine. There is another ORM named Propel that has a similar history to Doctrine and was once on equal footing within the Symfony framework, but Symfony has more or less adopted Doctrine as its standard now. These are all open source/free as in beer with open source licenses. If you have heard of Ruby on Rails, you might know that Rails is an MVC framework, but it comes with an ORM known as ActiveRecord. Several of the ORM's I mentioned are Active Record implementations. Active Record is an OOP design pattern. Doctrine, which I prefer, is a "Data Mapper" pattern implementation. It has some different concepts to it. If you don't use an ORM, you will likely try and build something yourself that has some of the properties of an ORM. You would do yourself a lot of good, on whatever phase you are on, to adopt one of these libraries, even if you aren't using every aspect of them. They provide the "model" portion of Model View Controller (MVC) systems. It is also possible to build a subsystem using an ORM even if the system has lots of existing code that doesn't use the ORM. I have done this on projects any number of times. I don't think you really can afford to delay that. It explains autoloading, dependency management and component libraries. Even if you don't plan on using a full framework, what this explains is how the modern dependency injection frameworks are put together. They aren't a monolithic blob of interdependent code, but rather a number of component libraries that each do a different thing. The last half of the video is him going through a number of the symfony component libraries, with dead simple examples of things you can do with them in 5 lines of code. The world of professional PHP programming involves using component libraries now. If you aren't using them, you are doing it wrong. This isn't some thing you should get to some time in the future. It's been 8 years since this became the defacto standard way of developing PHP applications. Logging for your app? Component Library. Generate a pdf? Component Library. Send emails? Component Library. The video explains this and a bit on how to identify the ones you want to lean towards, as there are often many component libraries out there that solve a certain problem.
  22. This is your subtype table, correct? You do not need id+product_type. You simply need id in the subtype table. You need the product_type_code (why code btw?) to determine which subtype table, but there is no value in bringing along the product_type_code. This is called a "defining relationship". The best way to think of it, is that the primary key of product (id) will be the primary key of product_{product_type} Here is a basic ERD of the relationships in MySQL Workbench Here's generated SQL: -- ----------------------------------------------------- -- Table `mydb`.`product_type` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mydb`.`product_type` ( `code` CHAR(1) NOT NULL, `name` VARCHAR(30) NULL, PRIMARY KEY (`code`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`product` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mydb`.`product` ( `id` INT NOT NULL AUTO_INCREMENT, `product_type_code` CHAR(1) NOT NULL, `name` VARCHAR(60) NULL, PRIMARY KEY (`id`), INDEX `fk_product_product_type_idx` (`product_type_code` ASC), CONSTRAINT `fk_product_product_type` FOREIGN KEY (`product_type_code`) REFERENCES `mydb`.`product_type` (`code`) ON DELETE RESTRICT ON UPDATE CASCADE) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`product_subscription` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mydb`.`product_subscription` ( `product_id` INT NOT NULL, PRIMARY KEY (`product_id`), CONSTRAINT `fk_product_subscription_product1` FOREIGN KEY (`product_id`) REFERENCES `mydb`.`product` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`product_article` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mydb`.`product_article` ( `product_id` INT NOT NULL, PRIMARY KEY (`product_id`), CONSTRAINT `fk_product_article_product1` FOREIGN KEY (`product_id`) REFERENCES `mydb`.`product` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `mydb`.`product_promotional` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `mydb`.`product_promotional` ( `product_id` INT NOT NULL, PRIMARY KEY (`product_id`), CONSTRAINT `fk_product_promotional_product1` FOREIGN KEY (`product_id`) REFERENCES `mydb`.`product` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB; Notice what there is and isn't. There is no code that creates indexes, because INDEX and KEY are the same in MySQL/InnoDB DDL. Making the key makes the index.
  23. You can run the httpd.exe from a cmd and get a list of the installed modules: drive:/path/to/apache/httpd.exe -t -D DUMP_MODULE
  24. I thought you were planning to write the DDL. Clicking away at phpMyAdmin like a monkey is about the least efficient way to do this I can think of. You were arguing to me that you didn't have time to learn how to use mysql workbench and make an ERD! This is the type of response that you sometimes use to rebuff advice, which leaves many of us with the impression that you rationalize your predispositions. You absolutely should have a full sql script with all the DDL to create all the tables, and constraints.
  25. Those are reasonable standards, but you have to keep in mind that postgresql and mysql have significant differences. With Mysql/InnoDB there is no difference between keys/indexes and constraints. Of course constraints have optional on update and on delete configuration, but in terms of the underlying mechanics of indexing, an fk constraint creates a corresponding index. I don't want to get into re-writing the MySQL manual, but there are now check constraints in the latest versions of MariaDB and MySQL I really haven't used, but I only mention this for completeness. The only way you can name an index or constraint is to create it separately from your create table statement via alter table. So you'll need to decide if naming things via a convention that is different from the defaults is important enough for you to have to break up the activity of table creation into multiple create and alter statements, and of course keep track of this fact should you need to make changes during the development phase and in the future, which in my experience is inevitable.
×
×
  • 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.